| Author |
Topic |
|
challa_praveena
Starting Member
7 Posts |
Posted - 2004-07-07 : 19:13:27
|
| hi guys, I have an urgent problemI need to get 11 months -starting from current month + following 11 months which could be suppose this month is 7 so remaining months of year 2004 and followed by starting of 2005 till the 11 months duration is metplease help me out.thank you pivi |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2004-07-07 : 19:32:43
|
| SELECT....FROM ....WHERE dateField BETWEEN GetDate() AND DateAdd(m, 11, GetDate())That's how to do it. You may need to finetune a bit to suit your particular needs. Check out DateAdd/DateDiff in BOL for more info |
 |
|
|
challa_praveena
Starting Member
7 Posts |
Posted - 2004-07-07 : 19:35:29
|
| thank you very much it worksthank you so much pivi |
 |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2004-07-07 : 19:40:02
|
| look into the dateadd/datediff function in books online.For beginning of the month + 11check out the following and you'll get the picture:select dateadd(mm,datediff(mm,0,getdate()),0)select dateadd(mm,11,dateadd(mm,datediff(mm,0,getdate()),0))select dateadd(mm,11,getdate())select dateadd(d,0,datediff(d,0,dateadd(mm,11,getdate()))) |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-07-08 : 04:22:00
|
| PMFBI: I prefer to use "Day" and "Month" as the parameter name for DATEADD and DATEMONTH. I think it is easier for the novice to understand and no confusion between Month ("m" or "mm") and Minute ("mi") or MilliSecond ("ms"); also, "y" or "dy" means DayOfYear, whereas "yy" or even "yyyy" means Year and "d" or "dd" means Day ...Kristen |
 |
|
|
Wanderer
Master Smack Fu Yak Hacker
1168 Posts |
Posted - 2004-07-08 : 06:31:34
|
| PMFBI ? You lost me, Kristen...*##* *##* *##* *##* Chaos, Disorder and Panic ... my work is done here! |
 |
|
|
chloee
Starting Member
13 Posts |
Posted - 2004-07-08 : 07:01:31
|
| Pardon Me For Butting In |
 |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
|
|
Wanderer
Master Smack Fu Yak Hacker
1168 Posts |
Posted - 2004-07-08 : 07:28:40
|
ahahC4N(Ciao 4 Now) *##* *##* *##* *##* Chaos, Disorder and Panic ... my work is done here! |
 |
|
|
|