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 |
|
udayr
Starting Member
2 Posts |
Posted - 2009-08-11 : 13:09:54
|
| Hello Guys..I am quite new to SQL Server....I have a question regarding a stored procedure...Here is the question..I have a stored procedure : -StoredProcedure1 that select certains rows from bunch of tables..- I also have storedprocedure2 in which I have to populate a temp table with rows returned by executing the storedprocedure1...Is it possible in StoredProcs..I appreciate any help in clarifying this...thanks...UdayUdayr |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-08-11 : 13:14:28
|
| HiAm not getting your point. why you are create Procedure two.In stored procedure one itself you can store the values from SELECT statement...IF am in wrong correct me...-------------------------R..http://code.msdn.microsoft.com/SQLExamples/http://msdn.microsoft.com/hi-in/library/bb500155(en-us).aspx |
 |
|
|
udayr
Starting Member
2 Posts |
Posted - 2009-08-11 : 13:44:30
|
| Hi..Thanks for the reply...I have also thought of the same...but the storedProcedure1 to be used in storedproc2 is based in the input parameters...Here is wat I am thinking of the solution...create stored proc2@ storedProc1 create a temp table 'TEMP' Insert into TEMPexec (@storedProc1)..........Udayr |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-08-11 : 13:50:43
|
HIHere what is ur problem....I think this is fine...create proc proc1asBEGIN SELECT COL1, COL2 INTO #temp FROM TABLE_NAME WHERE 1=1 SELECT * FROM #TEMPDROP TABLE #tempEND -------------------------R..http://code.msdn.microsoft.com/SQLExamples/http://msdn.microsoft.com/hi-in/library/bb500155(en-us).aspx |
 |
|
|
|
|
|