| Author |
Topic  |
|
|
excelenvironment
Starting Member
2 Posts |
Posted - 03/10/2013 : 19:55:30
|
Hi! I am new! I am trying to figure out how I would change the bellow declare to get data from the 1st of March to the 31st of March 10, 2013. Does my question make sense?
Declare @Actdate varchar(20) Set @Actdate = (Select DATEPART(yyyy, DATEADD(DD,-1,getdate()))*10000 + DATEPART(mm, DATEADD(DD,-1,getdate()))*100 + DATEPART(dd, DATEADD(DD,-1,getdate())))
|
|
|
excelenvironment
Starting Member
2 Posts |
Posted - 03/10/2013 : 20:19:29
|
| *Date range 1st of March to 31st of March |
 |
|
|
jimf
Flowing Fount of Yak Knowledge
USA
2868 Posts |
Posted - 03/10/2013 : 20:29:06
|
Your question doesn't make any sense, but I assume you want the beginning and ending of the current month? declare @date date = getdate() select DATEADD(month,datediff(month,0,getdate()),0) ,DATEADD(month,datediff(month,-1,getdate()),-1)
Is Actdate really a varchar or a date?
Jim
Everyday I learn something that somebody else already knew |
 |
|
| |
Topic  |
|
|
|