SQL Scrapbook

Short and simple SQL Server posts

SQL Date Cheat Sheets

leave a comment »

This post will show the commonly used queries to play with date functions in SQL Server. And yes i hope to update this list frequently.
Currently the following script has queries to:
Select two digit month, Select the first and last day of the month…

 --query to select month in two digits
SELECT	[TwoDigitMonth]
--select first day of month
 SELECT	[FirstDayofMonth]
--select last day of month
 SELECT	[LastDayofMonth]

You can replace the GETDATE() with a variable to use this for any month.


Written by sqlscrapbook

October 20, 2010 at 7:46 pm

Posted in TSQL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: