Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
arpost
Post Prodigy
Post Prodigy

Any ideas on how to pass a string to a stored procedure for an IN clause?

Greetings, all. I have an array/list of values I want to pass to a stored procedure in a data warehouse and use the values in an IN statement. I can't figure out how to make this work, however, and am hoping someone can assist.

 

Here's an example of the list:

'ABC','DEF','GHI'

And here's a sample of what the sproc script could look like where @List is the parameter for the sproc:

 

SELECT Top 10 *
FROM Table
WHERE Column1 in (@List)

 

When applied, the executed script would look like so:

SELECT Top 10 *

FROM Table

WHERE Column1 in ('ABC','DEF','GHI')

Any ideas on how I can convert the string into a useable list on the warehouse side of things?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @arpost ,
Thanks for using Fabric Community.
Yes you can convert the string into a useable list in the Fabric Warehouse. I have created a repro of the scenario and was successful in executing the stored procedure. Below are the steps I followed along with the screenshots:

1) I have a table named FabricDemo in my warehouse which has a column named "Code" .
       

vnikhilanmsft_0-1697044637241.png


2) I have created a stored procedure named 'infunc3' as follows:

Here we are passing our input as string and using STRING_SPLIT() function to split the input string.

vnikhilanmsft_2-1697045121766.png

 

3) After creating the stored procedure, I executed the stored procedure by giving the column values as follows and was successful in getting the records with 'Code' column as 'DNK', 'FIN' and 'ECU'.

vnikhilanmsft_3-1697045142827.png

 

Hope this helps. Please let me know if you have any further queries.

View solution in original post

3 REPLIES 3
arpost
Post Prodigy
Post Prodigy

That did the trick! Thanks, @Anonymous.

Anonymous
Not applicable

Hi @arpost ,
Glad that your issue got resolved. Please continue using Fabric Community for any help regarding your queries.

Anonymous
Not applicable

Hi @arpost ,
Thanks for using Fabric Community.
Yes you can convert the string into a useable list in the Fabric Warehouse. I have created a repro of the scenario and was successful in executing the stored procedure. Below are the steps I followed along with the screenshots:

1) I have a table named FabricDemo in my warehouse which has a column named "Code" .
       

vnikhilanmsft_0-1697044637241.png


2) I have created a stored procedure named 'infunc3' as follows:

Here we are passing our input as string and using STRING_SPLIT() function to split the input string.

vnikhilanmsft_2-1697045121766.png

 

3) After creating the stored procedure, I executed the stored procedure by giving the column values as follows and was successful in getting the records with 'Code' column as 'DNK', 'FIN' and 'ECU'.

vnikhilanmsft_3-1697045142827.png

 

Hope this helps. Please let me know if you have any further queries.

Helpful resources

Announcements
April Fabric Update Carousel

Fabric Monthly Update - April 2026

Check out the April 2026 Fabric update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.