February 12, 2013 at 4:49 pm
@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?
February 12, 2013 at 5:49 pm
Yes, change to use Table-Valued Parameters instead of passing in a comma-delimited list of values in a single parameter.
Table-Valued Parameters (Database Engine) - SQL Server 2008 R2
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
February 12, 2013 at 6:11 pm
If you can NOT use the suggestion of opc.three
Read the following article by Jeff Moden:
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply