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 |
kishoremcp
Starting Member
41 Posts |
Posted - 2013-09-19 : 03:53:37
|
Hi, I have a date format in SQL database like 2008-03-13 13:22:38.000I want the output as 200803(YYYYMM). Please hlep me how to convert it. Thanks in advance..Regards, KishoreRegardsKishore |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2013-09-19 : 04:28:12
|
SELECT CONVERT(CHAR(6), Col1, 112) FROM dbo.Table1; Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
 |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
|
VeeranjaneyuluAnnapureddy
Posting Yak Master
169 Posts |
Posted - 2013-09-19 : 05:19:15
|
SELECT CONVERT(CHAR(6),CAST(GETDATE() AS DATE),112)veeranjaneyulu |
 |
|
sigmas
Posting Yak Master
172 Posts |
Posted - 2013-09-19 : 05:36:32
|
SELECT replace(left(cast(getdate() as date),7),'-','') |
 |
|
|
|
|
|
|