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 |
Vack
Aged Yak Warrior
530 Posts |
Posted - 2010-11-10 : 10:17:27
|
I have a field that is char 15I want to update the field so that it has leading zeros in it. Table name: altslsField Name: cus_cddata in field is 1. I want it to be 000000000000001 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-11-10 : 10:19:24
|
[code]UPDATE altslsSET cus_cd = RIGHT('000000000000000' + cus_cd ,15)[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-11 : 04:44:31
|
If it is only for selection select replace(STR(cus_cd ,15),' ','0') from altslsupdation update altslsSET cus_cd =replace(STR(cus_cd ,15),' ','0')MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|