johnson1
asked on
sql replace - words from another table
Hello,
I want to find all words in @StringTable where matching words are in Word column in @TableReplacelist and replace it with value from ReplaceWord column.
DECLARE @TableReplacelist table(Word varchar(50), ReplaceWord varchar(50))
INSERT INTO @TableReplacelist(Word,Rep laceWord)v alues('One ','Eins')
INSERT INTO @TableReplacelist(Word,Rep laceWord)v alues('Two ','Zwei')
INSERT INTO @TableReplacelist(Word,Rep laceWord)v alues('Thr ee','Drei' )
INSERT INTO @TableReplacelist(Word,Rep laceWord)v alues('Fou r','Vier')
DECLARE @StringTable table(Id int, MyString varchar(max))
INSERT INTO @StringTable(Id,MyString)v alues(1,'H ere is One and Three')
INSERT INTO @StringTable(Id,MyString)v alues(2,'H ere is One and Four')
If I would select all from @StringTable it should be modify like this:
1 Here is Eins and Drei
2 Here is Eins and Vier
Can you please suggest the best approach for this?
I want to find all words in @StringTable where matching words are in Word column in @TableReplacelist and replace it with value from ReplaceWord column.
DECLARE @TableReplacelist table(Word varchar(50), ReplaceWord varchar(50))
INSERT INTO @TableReplacelist(Word,Rep
INSERT INTO @TableReplacelist(Word,Rep
INSERT INTO @TableReplacelist(Word,Rep
INSERT INTO @TableReplacelist(Word,Rep
DECLARE @StringTable table(Id int, MyString varchar(max))
INSERT INTO @StringTable(Id,MyString)v
INSERT INTO @StringTable(Id,MyString)v
If I would select all from @StringTable it should be modify like this:
1 Here is Eins and Drei
2 Here is Eins and Vier
Can you please suggest the best approach for this?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER