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-09-14 : 11:32:53
|
| I have a table that has a field that stores excel file names.957.xls10049.xlswhat I want to do is strip the .xls and add leading zeros to the first portion so that it is a size of 12 and update a 2nd field in the same table. 000000000957000000010049Table name is xlscustomerField that contains 957.xls is field_nameField I want to update is cus_no |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-09-14 : 11:43:54
|
update your_tableset cus_no = right('000000000000' + replace(field_name,'.xls',''),12)where cus_no is null --condition should avoid from updating rows where the column is already filled No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-09-14 : 11:44:36
|
again No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|