Thursday, May 4, 2017

Cinnamon Bourbon Peach Upside Down Spice Cake

I made a cinnamon bourbon peach upside down spice cake for my roommate's birthday and had a few people asking for the recipe. Like most things I make, I kind of throw a lot of stuff together. That being said...I thought I would type this one up using a couple of cheats. One big cheat will be using a boxed yellow cake.

I have to say this cake is by far 1000 times better than the normal pineapple upside down cake.  I hope you enjoy it as much as we did.

Cake Layer Ingredients:

1 Table spoon ground cinnamon
peach juice to substitute for water (optional)

Prepare the box cake per instructions on the box. Instead of using water for the box cake, I substituted with the peach juice from my canned peaches.   Please note I didn't use the canned peaches in syrup. BLAH.  I actually used peaches canned in juice.  After the cake was all mixed up, I added the cinnamon to tie in the the flavors of the cinnamon bourbon aka Fireball that I was adding to the bottom layer.

Bottom Layer Ingredients:

1/2 cup melted butter
1 cup brown sugar
1 shot (I used 2) Cinnamon Bourbon aka Fireball
1 can sliced chopped peaches (in juice not syrup)

Directions: 

Preheat the oven per the box cake instructions.

Mix the box cake per instructions given, substitute peach juice for the water that is required. Add the Table spoon of cinnamon and set aside.

Spray the pan you are using (I used 9 x 13).

Spread around the chopped peaches.

Sprinkle the brown sugar all over the peaches.

To the melted butter, add the Cinnamon Bourbon and combine.  Pour this over the brown sugar and peaches.

To this, pour over the mixed cake batter.

Bake it per the instructions on the box for the pan you choose.

I served with vanilla ice cream.  I hope you enjoy.



If you like this post and want to see more, follow me on my website www.chadcompton.com Or if you prefer...


Tuesday, January 24, 2017

SQL DATEADD() Function

It has been quite a while since I have provided a tip for you guys/gals, but now I am back on the wagon.   I will be posting on a regular basis.  I have also decided to stop numbering the tips from this day forward. That being said...

Yesterday I ran across a problem where I had to check to see if a certain file called 'Test' was received within the last two years.

To accomplish this, I used the DATEADD() Function which adds or subtracts a specific time interval from a given date.


Syntax:

DATEADD (datepart, number, date)

The datepart can be broken down by year (yy, yyyy) , quarter (qq, q) , month (mm, m), dayofyear (dy, y), day (dd, d), week (wk, ww), weekday (dw, w), hour (hh), minute (mi, n), and second (ss, s) just to name a few.


Example Code:

Select *  from Table where DocumentType = 'Test' 
and  DateReceived >= DATEADD (yy, -2, GETDATE())
If you like this post and want to see more, follow me on my website www.chadcompton.com Or if you prefer...


Thursday, August 25, 2016

Update SQL Keep Characters to the Left

Today I ran across an issue with an SQL table that received an injection that inserted bad data at the end of certain fields in all of the records.  I had to write some code that would find the bad data and strip it off of the end of the good data.  After writing the code, I thought I would share with those interested.

Example:

In this specific example, the tblNews table received a SQL Injection that inserted a long strand of bad data at the end of the Body field.  Lucky for me, the Injections all started with '<div style='.  That specific hunk of characters is what I used to track them all down.  I first created a query to pull all the records to see what I was looking at.  Then typed an Update statement that removed all the characters to right of  '<div style='.

Initial Pull:




SELECT * from tblNews
where Body like '%<div style=%'


Update Code:


UPDATE tblNews
Set Body = LEFT (Body, CHARINDEX('<Div style=', Body) - 1)
where Body like '%<div style=%'



If you like this post and want to see more, follow me on my website www.chadcompton.com Or if you prefer...


Tuesday, June 28, 2016

Concatenate 2 Integers Into 1 Varchar (SQL)

Yesterdays Just A Tip Felt so good, I thought I would do it again today.  Twice in one week.  You guys & gals get a great tip, while I get another notch under my belt.  Win.  Win.

Today's coding issue involves 2 Integer fields that need to be concatenated into 1 big field and that field needs to be Varchar.  To accomplish this, you will need to Cast each  Integer as a Varchar then concatenate them.
For Example, in an SQL table called tblPetOwners you have 2 fields (OwnerNumber & PetNumber)   which are Integers and wish to join them with an '&' in between them.  To do this, you have to CAST them both as Varchar before concatenating them.  Below is the best way I have came across to accomplish this task and I show you the data in the table, the code itself, followed by the results.

Table tblPetOwners Data:


OwnerNumberPetNumber
223122543224
643233235432
332342654523
Example Code:

SELECT CAST(OwnerNumber AS VARCHAR(10) ) 
+ ' & ' + 
CAST(PetNumber AS VARCHAR(10) ) OwnerAndPet, OwnerNumber, PetNumber 
FROM tblPetOwners



Results Data:


OwnerAndPetOwnerNumberPetNumber
223122 & 543224223122543224
643233 & 235432643233235432
332342 & 654523332342654523

If you like this post and want to see more, follow me on my website www.chadcompton.com
Or if you prefer...


Monday, June 27, 2016

Union & Count Together in A SQL Query

I know it has been a while since I have given you a good tip...So without further ado.

Today I had a situation where I needed to give a count of items that were across a couple of tables and involved a few unions in SQL.  Since my query took up about 2 pages, I figured I would make a simple version for all you folks out there reading this.  I hope it helps.

For Example, let us say you have two tables ( Results & ArchivedResults) and were needing to get a count on them both.  Let us also assume you didn't use a JOIN because of the different criteria in each SQL statement.  Based off those results you need to get a count.  Below is how this can be accomplished.

Example Code:
SELECT PullResults.Name, COUNT(*) 
FROM  (SELECT Name FROM Results
UNION ALL
SELECT Name FROM ArchivedResults) as PullResults
GROUP BY Name
ORDER BY Name

If you like this post and want to see more, follow me on my website www.chadcompton.com
Or if you prefer...


Tuesday, May 24, 2016

SUM Using Group By (SQL)


At some point, you will be required to use the SQL GROUP BY clause with the SQL SUM function.  My time to use this was today and I thought I would create this post to help anyone else that may be needing to accomplish the same.
For example, you could also use the SQL SUM function to return the name of the department and the total sales (in the associated department).

Example Code:
SELECT department, SUM(sales) AS "Total sales"
FROM order_details
GROUP BY department;
Because you have listed one column in your SQL SELECT statement that is not encapsulated in the SQL SUM function, you must use the SQL GROUP BY clause. The department field must, therefore, be listed in the SQL GROUP BY section.
If you like this post and want to see more, follow me on my website www.chadcompton.com
Or if you prefer...


Tuesday, April 26, 2016

AVG Function (SQL)

Over the last couple of coding posts I have showed you how to use the SUM function.  This being said, I thought I would show you how to use the AVE function in SQL.  


Use the AVG() Function to get the average of a of a specific numeric column.  Below is an example of it being used.

SQL AVG Example:


SELECT  AVG(ColumnName) 
FROM TableName;


If you like this post and want to see more, follow me on my website www.chadcompton.com
Or if you prefer...