Q
Problem solve Get help with specific problems with your technologies, process and projects.

Using a string list as a parameter in a stored procedure

I am passing a parameter to a stored procedure through a string variable by name strlist which contains a list of comma separated values like "a,b,c,d," which I intend to use in a stored procedure, using it as filter criteria for one of the sub-queries like

select ... where o in strlist.
Is this possible in SQL Server to use a variable for a criteria like this?

Yep, but you have to dynamically build the query. You can not hand a list to a variable and then directly use that single variable.

For More Information

Dig Deeper on SQL Server Stored Procedures

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close