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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-09-20 : 07:17:01
|
| Eyoel writes "I had forgotten something...please see belowI have a situation....I haveetable AID Description1 X2 y3 zI want to update table B that has ID's linked to table Abut the column that has the ID in table B contains ID separated by comma, as inBID ColumnToBeUpdated1,2,3 some text:1,2,33 anotehrtext:3So eventually I want table B to look likeBID ColumnToBeUpdated1,2,3 some text:x,y,Z3 anothertext:zI was able to update the values for the single BID ( which is a char ) in table B by doing a simple inner join and using charindex = 0 but I am having problems to parse the value with comma and update accordingly. This is what i have so far...UPDATE b SET b.ColumnToBeUpdated = 'some text:' + a.Descriptionfrom table Binner join table AON b.bid = a.ID where (CharIndex(',', b.bid, 1) = 0)I was trying to use cursor to no avail.Please help !Eyoel" |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-09-20 : 07:40:04
|
| Use a function which parses comma-separated values and returns table of values and use this table to join with TableA.Check the following link for more help:[url]http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm[/url]Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
|
|
|