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 |
|
ams006
Yak Posting Veteran
55 Posts |
Posted - 2009-02-24 : 05:22:44
|
| Hi All, Hope someone can help me out. It's wuite an urgent resolution that I need. I'm trying to calculate the number of months between two dates in SQL Server 2005. Does anyone have any ideas? Thanks in advance. ams006 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-02-24 : 05:25:45
|
[code]selectdatediff(month,'20080101',getdate())[/code]gives 13Webfred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Mangal Pardeshi
Posting Yak Master
110 Posts |
Posted - 2009-02-24 : 05:26:46
|
| Try datediff function-DECLARE @d1 DATETIME,@D2 DATETIMESET @D1 = '20080501'SET @D2='20090101'SELECT DATEDIFF(MM,@d1,@d2)Mangal Pardeshihttp://mangalpardeshi.blogspot.com |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-02-24 : 05:41:21
|
someone else there to repeat? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
ams006
Yak Posting Veteran
55 Posts |
Posted - 2009-02-24 : 05:41:25
|
Thank you all |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-02-24 : 11:41:46
|
Wow - I didn't knew that!Thanks a lot for that link VISAKH.GreetingsWebfred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-24 : 12:27:41
|
| welcome |
 |
|
|
|
|
|