I'm trying to create a stored procedure in SQL Server 2008 that takes a comma separated list of ints and adds them to a table.
For this example, the table has 1 column. So the stored procedure would just take a string like '1,2,3' and insert 3 rows into the table.
I'm not really sure how to go about doing this. Do I have to write something to split the string and then manually loop through the ids? Can I do something like
insert into table values split(idsString)
and somehow do it in one statement instead of a manual loop?