October 28, 2008 at 11:27 am
Hello
I have a field name called description, and i will like to update all rows with the word 'Jasper Conran' to 'JC'.
eg 'Black and Green Jasper Conran XXL' to 'Black and Green JC XXL'
'Black and Red Jasper Conran XXL' to 'Black and Red JC XXL'
does anyone have an idea how this can be done with a query to update the whole table with a million rows?
October 28, 2008 at 12:17 pm
If I read this correctly and you ONLY want to change the values of Jasper Conran to JC then you can use the REPLACE command...
SET , 'Jasper Conran', 'JC' )
DAB
October 28, 2008 at 12:19 pm
Sorry about that, the " "got stripped.
I meant
SET column1 = REPLACE( column1, 'Jasper Conran', 'JC' )
October 28, 2008 at 12:37 pm
SQLServerLifer (10/28/2008)
Sorry about that, the " "got stripped.I meant
SET column1 = REPLACE( column1, 'Jasper Conran', 'JC' )
I'd go a little further:
update dbo.YourTable set
description = replace(description, 'Jasper Conran', 'JC')
where
description like '%Jasper Conran%';
October 28, 2008 at 1:20 pm
Lookup REPLACE in Books Online:
SELECT REPLACE(description, 'Jasper Conran', 'JC') ...
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply