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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 dates between current month and current month + 10

Author  Topic 

challa_praveena
Starting Member

7 Posts

Posted - 2004-07-07 : 19:13:27
hi guys,


I have an urgent problem

I 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 met

please 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
Go to Top of Page

challa_praveena
Starting Member

7 Posts

Posted - 2004-07-07 : 19:35:29
thank you very much


it works

thank you so much

pivi
Go to Top of Page

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 + 11
check 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())))
Go to Top of Page

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
Go to Top of Page

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!
Go to Top of Page

chloee
Starting Member

13 Posts

Posted - 2004-07-08 : 07:01:31
Pardon Me For Butting In
Go to Top of Page

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-07-08 : 07:24:33
Yeah - Go to acronymfinder.com if you are not sure.

http://www.acronymfinder.com/af-query.asp?String=exact&Acronym=pmfbi&Find=Find


Duane.
Go to Top of Page

Wanderer
Master Smack Fu Yak Hacker

1168 Posts

Posted - 2004-07-08 : 07:28:40
ahah

C4N

(Ciao 4 Now)



*##* *##* *##* *##*

Chaos, Disorder and Panic ... my work is done here!
Go to Top of Page
   

- Advertisement -