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 |
|
rbfigueira
Starting Member
4 Posts |
Posted - 2009-08-24 : 11:21:39
|
| Hi,Can anyone tell me the best way to format one string ?Example:select CONVERT(char (2),month(getdate()))Result:----8 When the result is only one caracter I must to add the zero "0" on left. In this case I must have 08 as result.Result:----08 Thanks |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-08-24 : 11:33:08
|
| Try thisSELECT Replace(Str(month(getdate()), 2), ' ', '0')Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-08-25 : 03:06:29
|
| Where do you want to show converted months?If you use front end application, use format function thereMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|