A N

June 25, 2015

SQL – First and Last day of previous month

Filed under: Tips — donrsh @ 1:36 pm
	select (dateadd(month,datediff(month,(0),getdate())-1,(0))),
	'first day of previous month'
	union
	select (dateadd(month,datediff(month,(0),getdate())-1,(30))),
	'Last day of previous month' 
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: