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 |
|
shanmugaraj
Posting Yak Master
219 Posts |
Posted - 2011-11-17 : 02:19:12
|
| HI,I need the query for belowI have an nvarchar(10) filedI have values less than 10, and i want them to be filled with 0 beforeIe:1506721226705475612875697113should be saved as00001506720000122670000005475600000000560000097113THANKSSHANMUGARAJnshanmugaraj@gmail.com |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-17 : 03:59:37
|
| RIGHT('0000000000' + field,10)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
shanmugaraj
Posting Yak Master
219 Posts |
Posted - 2011-11-17 : 04:22:39
|
| It works cool !Thanks a Lot visakhmTHANKSSHANMUGARAJnshanmugaraj@gmail.com |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-17 : 04:38:20
|
| wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-11-21 : 03:05:41
|
| Alternatively, if you want to show data in front end application, use format functions thereAnother method isselect replace(str(col,10),' ','0') from tableMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|