Feeds:
Posts
Comments

Posts Tagged ‘sql’

This is a script I wrote to use when I need to get the quarter begin and end dates for SQL.


declare @date datetime

declare @begdate datetime

declare @enddate datetime

set @date = getdate()

--get first day of CURRENT qtr 

set @begdate = dateadd(q, datediff(q, 0, @date), 0)

--get last day of CURRENT qtr 

set @enddate = dateadd(q, datediff(q, 0, dateadd(q, 1, @date)), -1)

select @date as today, @begdate as QtrBegin, @enddate as QtrEnd

Advertisements

Read Full Post »