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 |
|
cyberpd
Yak Posting Veteran
60 Posts |
Posted - 2009-10-16 : 08:14:50
|
| I have a table names test.The field name is T1 (varchar(50)).The values are as follows: - NS000090:DEV91943:ST001:CT001NS000090:DEV91943NS000090:DEV91944:ST001:CT001NS000090:DEV91944NS000090:DEV91945:ST001:CT001etc...I want to update the field T1 where only the "NS000090" part will change to "NS000089" , rest of it will be same.something like this:-NS000089:DEV91943:ST001:CT001NS000089:DEV91943NS000089:DEV91944:ST001:CT001NS000089:DEV91944NS000089:DEV91945:ST001:CT001 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-10-16 : 08:34:11
|
replace(T1,'NS000090:','NS000089:') No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
cyberpd
Yak Posting Veteran
60 Posts |
Posted - 2009-10-16 : 09:10:01
|
| Thanks so much for the reply.I did not recollect Replace()I solved it like the following:-SET T1 = 'NS000089' + SUBSTRING(T1, 9, LEN(T1))Thanks again |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-10-16 : 09:20:34
|
Ok that's possible too but only if new and old value have same length.Cheers! No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|