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 |
|
konark
Yak Posting Veteran
60 Posts |
Posted - 2009-03-17 : 14:40:36
|
| 1) how can i get previous months id in yyyymm format ?Suppose this is march , the output will be 200902 in integer format.2) I have a dateId column (Integer data type) in yyyymmdd format . I want to convert them to yyyymm format.suppose input is 20090224 in interger , output will be 200902.Chandragupta Mourya |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-17 : 14:44:50
|
SELECT CONVERT(CHAR(6), DATEADD(MONTH, -1, GETDATE()), 112) E 12°55'05.63"N 56°04'39.26" |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-03-17 : 14:48:22
|
| [code]--1)select datepart(year,dt) * 100 + datepart(month, dt)from (select dateadd(month, -1, getdate()) dt) d--2) select 20090224 /100[/code]Be One with the OptimizerTG |
 |
|
|
|
|
|