Reputation: 391
I'm wondering if SQL Server has a way for me to AUTOMATICALLY list all the parameters that my stored procedure contains and then use it in a foreach similar to the below c# code
In C# it would be something like
Foreach(Parameter param in StoredProcedure)
{
if(param.value == "All")
{
param.value = "";
}
}
The foreach would obviously be in SQL code.
Upvotes: 0
Views: 903
Reputation: 10098
You're probably trying to solve the wrong problem here, but - here's the T-SQL statement that will retrieve all parameters for some stored procedure:
select *
from sys.parameters
where object_id = object_id('procedure_name')
order by parameter_id
Upvotes: 1