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 |
urzsuresh
Starting Member
30 Posts |
Posted - 2010-09-30 : 08:35:38
|
Hi, I need to bring the result ,what r t months falls between two dates.(i.e)Eg.1Declare @FrDate datetime,@ToDate datetimeSet @FrDate ='2010-01-31 17:38:58.577' Set @ToDate ='2010-03-01 17:38:58.577'need Output Result123Eg.2 Suppose date isDeclare @FrDate datetime,@ToDate datetimeSet @FrDate ='2010-05-31 17:38:58.577' Set @ToDate ='2010-09-01 17:38:58.577'need Output Result56789 Can anyone please guide me. how to bring this resultSuri |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-09-30 : 08:40:36
|
SELECT * FROM master..spt_values where type = 'p' and number between datepart(month, @frdate) and datepart(month, @todate) N 56°04'39.26"E 12°55'05.63" |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2010-09-30 : 12:45:50
|
urzsuresh,What do you want when the date range wraps around to another year (e.g., 2010-09-30 thru 2011-02-02)?=======================================In all life one should comfort the afflicted, but verily, also, one should afflict the comfortable, and especially when they are comfortably, contentedly, even happily wrong. -John Kenneth Galbraith, economist (1908-2006) |
|
|
|
|
|
|
|