Link to home
Start Free TrialLog in
Avatar of chokka
chokkaFlag for United States of America

asked on

How to execute a stored procedure by fetching row by row from a Table

In SQL, How to execute a stored procedure by fetching row by row from a Table ?

I have around 50 Stored Procedures which I have to execute one by one. All the stored procedures are mentioned in a Table along with their parameters.

At present, I am using a cursor to do this. Is it possible to implement the syntax through Row_Number - Partition Over by without using While Loop or Cursor ?
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

I don't think it's possible to do it without have a loop or a cursor.
Not really.  But unless there's more than several thousand rows, even a cursor should do that just fine.

The problem is likely just waiting on all the stored procs to finish.  You could, instead, create a job for each that executes all the procs, then start the job.  Then your main code will get control back immediately after the job starts, you won't have to wait for all the procs to complete.
ASKER CERTIFIED SOLUTION
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chokka

ASKER

Thank you , So bottom line is - To execute stored procedures one by one , Either we need to use Cursor or While Loop. There is no other option within the 5-6 lines of SQL Syntax.
Avatar of chokka

ASKER

Thanks