question

yxzhou624 avatar image
yxzhou624 asked

loop through stored procedures with input and output parameters

Hi, I am looking for a script for look through stored procedures with input and output parameters. I use the follow script to manually input 'processdate' and get the 'date id' as output. Everytime, I just change the @ProcessDate to process. Does anyone have a better way to write a loop to run this SP and set the @ProcessDate from '2017-04-30' to '2017-08-31'? Appreciate it!! Delare @ProcessDate datetime, @Date_ID int select @ProcessDate = '2017-04-29' exec casp_Dim_Date @ProcessDate, @Date_ID output
sql server 2008loop
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
anthony.green avatar image
anthony.green answered
A While loop will be the way to go DECLARE @ProcessDate DATE = '2017-04-30', @Date_ID int WHILE @ProcessDate
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.