Wednesday, September 26, 2012

Find Current Year Start Date and End Date in SQL?


select  DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)'Start Date ',
DATEADD(dd,-1,DATEADD(yy,0,DATEADD(yy,DATEDIFF(yy,0,getdate())+1,0))) 'End Date'


Output


Start Date                          End Date
2012-01-01 00:00:00.000 2012-12-31 00:00:00.000


0 comments:

Post a Comment