I have a stored procedure which i execute like this:
exec sp_storedProc '123','ME', '333',NULL
I have 400 different values I need to specify. How do I execute my stored procedure with different values at once?
You may try to do it using CURSORS
DECLARE @param INT
DECLARE curs CURSOR LOCAL FAST_FORWARD FOR
SELECT parameter FROM table_name WHERE ...
OPEN curs
FETCH NEXT FROM curs INTO @param
WHILE @@FETCH_STATUS = 0 BEGIN
EXEC sp_storeProc @param
FETCH NEXT FROM curs INTO @param
END
CLOSE curs
DEALLOCATE curs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With