declare @List varchar(25) = '2,3,4'
declare @Delinquencies table (id int);
insert into @Delinquencies(id) values('2'),('3'),('4'); --Line in question
@List
is being populated with a string populated from an SSRS report for which choices they have picked. Now the way my stored procedure is running, I need to be able insert into my table variable based on what varchar list is coming through. How can I insert into a table variable with a dynamic varchar list? What is listed here is about as close to the testing format as I can come.
I am using SQL Server 2008.
Example
@List = '1'
insert into @Delinquencies(id) values('1')
And any combination up to
@List = '1,2,3,4'
insert into @Delinquencies(id) values('1'),('2'),('3'),('4')