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 |
Addcom
Starting Member
5 Posts |
Posted - 2014-07-03 : 16:54:18
|
Trying to replace a string in a table and it is not working the path can be like \\OM-WD08-1\report\Data.raw. can some advice what is wrongThanks USE ConfigDECLARE @OldPath varchar(30), @NewPath varchar(30)-- Initialize the variableSET @OldPath ='\\OM-WD08-1\';SET @NewPath ='\\AA-PC\';UPDATE AnatomyConfigs SET Path = REPLACE(Path,@OldPath,@NewPath) WHERE Path IS NOT NULL AND Path LIKE @OldPathGOalbert |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-07-03 : 16:57:24
|
AND Path LIKE '%' + @OldPath + '%'Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
 |
|
Addcom
Starting Member
5 Posts |
Posted - 2014-07-07 : 04:48:46
|
Thanks for your solution, it worked as expectedWondering if the statement "Where Path IS NOT NULL and Path Like '@OldPath' will ever be true?I might just say "WHERE Path LIKE @OldPath"albert |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-07-08 : 12:41:17
|
Yes definitely modify the where clause to eliminate the unneeded part.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
 |
|
|
|
|