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 |
vani_r14
Starting Member
24 Posts |
Posted - 2008-03-26 : 05:25:18
|
Hi all I am new to TSQL Programming and in general to programming. I am working on producing a report which provides details about employees in departments. We currently have a stored procedure (Stored proc1) that accepts three parameters i.e.(the time frame and the department no). and have another stored procedure (Stored Proc2) that does all the transformation services for each employee. Stored proc1 then has the results (i.e. no of employees in the dept needed). for instance Dept Sales has 5 employees. What I need help with is the part where Stored Proc1 calls Stored Proc2 for each employee (i.e. 5 times) and produces the results. The way i have written it now it calls it ones. I realise i have to put a loop in Store proc1 so it can call the Stored Proc2 as many times needed but what I am not sure of is how to control the loop. I read abt Temp Tables could you please advise if that is a good option to use by anychanceAnyhelp is much appreciated and am stuck miserably. please point me in the right direction.Thanks in advanceVani :) :) |
|
jrogers
Starting Member
34 Posts |
Posted - 2008-03-26 : 05:30:09
|
do you need 2 stored procedures? IS it possible to return the results from a single sql statement? |
 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-03-26 : 05:30:22
|
If you post code of both of your SPs and tell us what kind of transformations you want to perform, someone can come up with set-based solution to avoid loop entirely.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
vani_r14
Starting Member
24 Posts |
Posted - 2008-03-26 : 22:57:00
|
hi allthanks for your help and suggestions. I have worked it out for the moment and it looks like it is fixed.  thanks for everything Vani |
 |
|
|
|
|