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 |
|
moorthy123
Starting Member
5 Posts |
Posted - 2012-11-26 : 15:13:44
|
| Hi All,Below query given me the exact date for dateid.for example: In date table, the dateID is 41048 and monthid is 1349while i use the below querySELECT CONVERT(DATETIME, 41048,101)Output:2012-05-21 00:00:00.000i got the exact date for that dateid, but i could nt do the same for monthid. how could we get the monthid from that dateidThanks in advance |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-11-26 : 15:22:30
|
| select datediff(month,-1,41048) , dateadd(month,1349,-1)JimEveryday I learn something that somebody else already knew |
 |
|
|
moorthy123
Starting Member
5 Posts |
Posted - 2012-11-27 : 10:14:52
|
| Thank you Jim. It works |
 |
|
|
|
|
|