1

Does SQL Server have the ability to accept a dynamic array of inputs and loop through the values?

For example:

I have multiple products with productId. Now, there will be times that I would need to delete some of those products. I can do this now by executing a stored procedure that accepts a productId value. My problem is I need to do this one by one.

What I would like to do is to send multiple productId's to the procedure and have the proc loop through those id's.

Is this possible?

1 Answer 1

2

This is possible in SQL Server 2008 using Table-Valued Parameters, in SQL Server 2005 is work around it by passing a Comma-separated List of Values. You can see all available options and implementations for 2008 here and for 2005 here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.