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 2005 Forums
 Transact-SQL (2005)
 SQL help

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-01-19 : 10:53:32
M writes "HI there,



I need your help to write SQL to accomplish below task.



Table I

col1 col2

3 2

4 2

1 3

6 3

Table1 col1 value is old value to be repalced with col2 value


Apply above replacement to table II


Current TABLE2
col1

[2] [3] [4] [5]

[3] [4] [5] [6]

[1][6]

[2] [3] [4] [9]

Table2 should look like
col1

[2] [5]

[2] [5] [3]

[3]

[2] [9]



Note: final value should not have repeated values like [2] [2] [5] … It should be [2] [5]



More info:

the column stores data like this



[1],[2],[3],[4]



Say 2, 3 are being put into 2 so the row becomes

[1],[2],[4]



Or say for instance you have this

[1],[2],[3],[4]



But 2, 4 are becoming 5 then it should go

[1],[5],[3]"

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-19 : 12:29:23
Already answered here
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=77782


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -