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 |
|
amsad
Starting Member
17 Posts |
Posted - 2011-02-22 : 03:59:28
|
| Hi guys,How to convert in sql, example number 1) 43 to be 00432) 3 to be 0003Any suggestion?need help..Thank you,Faizul Can do. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-02-22 : 05:07:28
|
43 to 0043:Source value comes from datatype INT?select right('0000'+convert(varchar(30),YourIntColumn),4)If you need to store this then a character datatype is needed... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
amsad
Starting Member
17 Posts |
Posted - 2011-02-22 : 05:21:42
|
| Hi webfred,It is working excellent!ThanksCan do. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-02-22 : 05:27:25
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-02-24 : 04:08:41
|
| You should do this in front end application. Otherwise, another method isselect replace(str(YourIntColumn),' ','0') from your_tableMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|