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 |
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2004-12-12 : 01:58:46
|
| Hi I have a table items with a description field --Is there anyway I can do find and replace to replace anywhere in description field where it says link.asp and change to item.asp? |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-12-12 : 03:47:05
|
| SELECT REPLACE(MyColumn, 'link.asp', 'item.asp')FROM MyTableor maybe:UPDATE MyTableSET MyColumn = REPLACE(MyColumn, 'link.asp', 'item.asp')Kristen |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2004-12-12 : 03:56:17
|
| and this will only replace where it says link.asp and not the whole field? |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2004-12-12 : 04:23:14
|
| I tried this:UPDATE itemsSET description = REPLACE(description, 'link.asp', 'item.asp') where itemid=450and got Server: Msg 8116, Level 16, State 1, Line 1Argument data type ntext is invalid for argument 1 of replace function. |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-12-12 : 10:09:36
|
| You can't use replace on a blob.You will have to split it into 8000 char chunks and do an updatetext on the field.You can use like to find the entries to update.I might do a solution for this later as it's been asked a number of times.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-12-13 : 00:23:23
|
| http://www.nigelrivett.net/SQLTsql/ReplaceText.html==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|