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 |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-06-07 : 08:19:31
|
Franck writes "HelloWhen I read your article Using REPLACE in an UPDATE statementI thought : That's exactly what I need...After a closer look, it seems it's not exactly true...REPLACE(string1,string2,string3) replaces all occurences of string2 by string3 in string1 and what I need to do is replace the first occurence and only the first one...is there a way to do this ?Please, say yes...I'm running SQL Server 2000 SP2 on Windows 2000 SP2.Thanks a lot" |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-06-07 : 08:33:51
|
DECLARE @find varchar(8000)SELECT @find='Replace this'UPDATE myTableSET myCol=Stuff(myCol, CharIndex(@find, myCol), Len(@find), 'Replacement text') |
 |
|
|
|
|