I am new to developing the stored procedures. So can anyone help me in developing the below requirement? Any help is appreciated.
There is a SQL table t1 with m*n columns in which one column contains SQL query for each row. I have written a stored procedure to read that query and execute the respective query to give the output results. This stored procedure (find below for SP) works only by giving the inputs manually. ----------------------------------------------------------------- Alter Procedure sp1 @primarykey int, @query nvarchar(max) OUTPUT AS Select @query= Query from t1 where primarykey=@primarykey GO
I want to execute the above stored procedure by passing the @primarykey ID dynamically (like @primarykey=1,2,3....max) to get the results of all the query's of each row.
For each query (i.e. for each primary key), the result sets will be different. I want to run multiple queries one by one by taking the input (PrimaryKey) dynamically.