Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jamie
Aged Yak Warrior
542 Posts |
Posted - 2008-02-25 : 09:29:13
|
| hi, can I use a case or if with a set command ?declare @Date2 datetimecase when day(getdate()) <20 THENSET @Date2 = DATEADD(dd,18,DATEADD(mm, DATEDIFF(mm,0,getdate()), 0))ELSESET @Date2= getdate()ENDSELECT @Date2This doesn't work, is there a similar way ? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-25 : 09:33:10
|
SELECT @Date2 = CASE WHEN day(getdate()) <20 THEN DATEADD(dd,18,DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)) ELSE getdate() ENDSELECT @Date2 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-25 : 09:33:31
|
| [code]declare @Date2 datetimeSET @Date2 =case when day(getdate()) <20 THEN DATEADD(dd,18,DATEADD(mm, DATEDIFF(mm,0,getdate()), 0))ELSE getdate()ENDSELECT @Date2[/code] |
 |
|
|
jamie
Aged Yak Warrior
542 Posts |
Posted - 2008-02-25 : 09:35:57
|
| thank you. |
 |
|
|
|
|
|
|
|