May 28, 2015 at 3:45 pm
I need to replace a name in this example Brighton in the field " Description" which looks something like this (BASE, Brighton, BLB3639, Maple, Bright White, Maple Drawers w/Blum Motion, Right Hand, Deluxe Cabinet Construction) with the correct name from the below table. The default value should be changed to the replacement value.
defaultvaluereplacement
Colony Colonial
Cottage Colonial II
Brighton Belleair
Homestead Shaker
Homestead II Shaker II
Harmony Hawthorne
Savannah Springfield
Briarwood Bronson
Jamestown Jupiter
Shelby Sanford
Lawrence Longwood
Yorktown Youngstown
May 29, 2015 at 12:26 am
This is not a very clear description of what you are trying to do. Can you post some DDL, consumable sample data and an example of the expected results?
-- Itzik Ben-Gan 2001
May 29, 2015 at 7:05 am
Use Jeff Moden's splitter (see Alan's signature) to split the column, LEFT join your correction table and USE FOR XML to concatenate the result (using either the replacement text or the original)
Far away is close at hand in the images of elsewhere.
Anon.
May 29, 2015 at 7:17 am
this statement would work but I was hoping to use a table so I don't have to hardcode this in the software.
replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(m1_dc.dbo.SalesOrderLines.omlPartLongDescriptionText,'Brighton','Belleair'),'Colony','Colonial'),'Cottage','Colonial II'),'Homestead','Shaker'),'Homestead II','Shaker II'),'Harmony','Hawthorne'),'Savannah','Springfield'),'Briarwood','Bronson'),'Jamestown','Jupiter'),'Shelby','Sanford'),'Lawrence','Longwood'),'Yorktown','Youngstown')
May 29, 2015 at 10:10 am
Take a look at this thread.
http://www.sqlservercentral.com/Forums/Topic1688498-3077-1.aspx
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply