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 |
cottage125
Starting Member
32 Posts |
Posted - 2013-02-12 : 19:09:46
|
@id = 1,2,3,4,5@name = 'NY, NJ, VA, DC,CA'I have a temp table called #tmp (id int, name varchar(4))I want to insert these above comma delimited values in this temp table.So 1 has corresponding value = NY, 2 has NJ etc...so total 5 rows will be inserted.Can u tell me the best way to code that? |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-02-13 : 02:23:53
|
using fnParseList from http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76033INSERT INTO #tmp (id, name)select i.Data, n.Datafrom dbo.fnParseList(@id) iinner join dbo.fnParseList(@name) n on i.RowID = n.RowID KH[spoiler]Time is always against us[/spoiler] |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|
|