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 |
|
sqlpgmr
Starting Member
4 Posts |
Posted - 2005-11-21 : 08:07:12
|
| Friends,What are the possible usuages of a SELECT query stmt inside a stored procedure ??How can we process the results of the SELECT query other than for documentation/Reporting purposes(Correct me if i'm wrong in this) ??can any one throw some lite on this ..Thanks,SqlPgmr |
|
|
surendrakalekar
Posting Yak Master
120 Posts |
Posted - 2005-11-21 : 08:12:04
|
quote: Originally posted by sqlpgmr SELECT query stmt inside a stored procedure ??How can we process the results of the SELECT query other than for documentation/Reporting purposes(Correct me if i'm wrong in this) ??Thanks,SqlPgmr
Use of SELECT inside SP is to select the records. There are number of ways to process the result. Either you can do it by using subquery, storing into temp table, using cursor etc.. etc.. or user can process those records in front-ent (if required)Read BOL for more information.Surendra |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-21 : 08:41:19
|
| >>What are the possible usuages of a SELECT query stmt inside a stored procedure ??It depends on what you are going to do with that resultsetMadhivananFailing to plan is Planning to fail |
 |
|
|
sqlpgmr
Starting Member
4 Posts |
Posted - 2005-11-21 : 08:41:44
|
| Thanks Surendra for the Quick response.Yes i understand.If i've a simple proc like thisCREATE PROCEDURE sp_testASBEGINSELECT * FROM EMPLOYEEENDand when i called the PROC within a procedure , is there any possibility of using this result set in the calling procedure??? |
 |
|
|
surendrakalekar
Posting Yak Master
120 Posts |
Posted - 2005-11-21 : 08:47:11
|
quote: Originally posted by sqlpgmr and when i called the PROC within a procedure , is there any possibility of using this result set in the calling procedure???
By executing proc within proc you can process/use it. To process/use resultset you can use Temp table/cursor's.READ BOL.Surendra |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-21 : 09:02:41
|
| Inside calling Procedure, use a table and assign values to itInsert into yourtable EXEC yoursp 'params' -- if anyMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|