How To Create A Date Table

Facebooktwitterredditpinterestlinkedinmail

Many times when developing SQL Server databases you have the requirement to show all dates in a range. One way to do this is with a date table. One of the most common reasons that I use a date table is when I have a reconciliation report. In a reconciliation report I want to show all of the days in a date range, even if they don’t have data on those days. SQL Server doesn’t have a function to generate dates in a range. So to accomplish this, I create a date table using the following script.

 

Insert Multiple Rows Of Static Text At One Time

Facebooktwitterredditpinterestlinkedinmail

Have you ever wanted to insert more than one row of static text in to a SQL table using the VALUES argument?  Well, this is actually pretty easy to do.  To do this you just need to pass a comma delimited value list like in the example below.

Syntax