May 25, 2015 at 9:21 am
Hi Team,
using below query to raplace the string values (REPLACE abc with T1223), how to use the query without hard coding.
i want to store the values in another temp table and access in main query.
'abc', 'T1223',
'def', 'T456',
'ghi', 'T789',
'jkl', 'T1011',
'mno', 'T12'
--
select id,name,
LTRIM(RTRIM(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(name,
'abc', 'T1223'),
'def', 'T456'),
'ghi', 'T789'),
'jkl', 'T1011'),
'mno', 'T12'))) New_id
from TAB
May 25, 2015 at 10:40 am
Please don't post multiple threads for the same problem. You'll only divide the help you would receive and confuse people on the version that you're using.
Further replies in here:
http://www.sqlservercentral.com/Forums/Topic1688498-3077-1.aspx
May 25, 2015 at 11:17 am
Minnu (5/25/2015)
Hi Team,using below query to raplace the string values (REPLACE abc with T1223), how to use the query without hard coding.
i want to store the values in another temp table and access in main query.
'abc', 'T1223',
'def', 'T456',
'ghi', 'T789',
'jkl', 'T1011',
'mno', 'T12'
--
select id,name,
LTRIM(RTRIM(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(name,
'abc', 'T1223'),
'def', 'T456'),
'ghi', 'T789'),
'jkl', 'T1011'),
'mno', 'T12'))) New_id
from TAB
Again, your request is a bit difficult to understand because you've not provided the necessary test data or DDL. Please see the your other post which appears to be a near duplicate to this one.
http://www.sqlservercentral.com/Forums/Topic1688465-3077-1.aspx
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply