Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bi89405
Starting Member
35 Posts |
Posted - 2011-05-30 : 13:09:44
|
Hello,I have a stored procedure that processes records one invoice at a time. In other words, it contains a variable that requires the user to input the invoice number and then it generates the fields needed for the invoice, lets call this sprocA. What I would like to do is create a SQL process that takes in an invoice date variable and collects all the invoice numbers processed based on the invoice date variable the user inputs. Then, I'd like to run each one of these invoice numbers collected from the SQL process against sprocA one at a time until and store the contents into a table in the database.Basically, at the end of the day, I want my result set to show all the data from sprocA but for all the invoices generated on the day entered by the user.Does anyone know of a way of doing this?Thanks in advance!Zack H. |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-05-30 : 15:01:44
|
Based on my understanding of your description, you would need to invoke sprocA in a loop, rather than recursively. If you have the ability to view the code in sprocA, it may be possible to create a new script or sproc that will process all the invoices for the date range in a set-based query. But, without seeing the existing sproc, and some sample input and corresponding output data, that is hard to tell.Brett's blog may be helpful in extracting and posting sample data and code: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
bi89405
Starting Member
35 Posts |
Posted - 2011-05-30 : 23:00:47
|
Hi sunitabeck,,Yes, you're absolutely right! I need to invoke sproc in a loop. Do you have an example of how to do this? The sproc is 354 lines of code.TIA,Zack H. |
 |
|
|
|
|
|
|