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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Search string and update row.

Author  Topic 

maevr
Posting Yak Master

169 Posts

Posted - 2008-01-18 : 05:36:10
I have a table that looks like below.
Table1
id: text:
1 1234, 3321
2 2222,6666,7777,8888,5555,3333
3 1234
......

I want to replace the values in the text column to other text values, for example 1234 = 'monkey' based on another table that contains the actual names:
Table2
id: name:
1234 monkey
3321 zebra
2222 tiger
......

The result should be:
Table1
id: text:
1 monkey, zebra
......

My idea is to separate the text based on the comma delimiter and insert the values in a temporary table and then along with it's id
id: text:
1 monkey
1 zebra
2 tiger
and then concaternate and insert the new string in Table1.

But how do I get this to work, any tips are helpful.

georgev
Posting Yak Master

122 Posts

Posted - 2008-01-21 : 09:57:33
I suggest normalisation ;)

id | text
1 | 1234
1 | 3321
etc


George
<3Engaged!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-21 : 10:59:44
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=95755

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -