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 |
|
shm
Yak Posting Veteran
86 Posts |
Posted - 2008-10-16 : 08:18:34
|
| hi,i have many SP but this shld be called when one Sprocedure is executedwt am getting as in the main proc two proc i called it is giving the result as two results..i want it shld be displayed in the single result..means the two proc wt i called that result shld come as a single result.... |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-16 : 08:32:27
|
| You should use OPENROWSET and return them as two resultsets and join based on joining columns.it wil be likeselect fields..from (select * from OPENROWSET(....,'EXEC SP1 value1,...')t1JOIN (select * from OPENROWSET(....,'EXEC SP2 value1,...')t2ON t1.field1=t2.field1....see belowhttp://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx |
 |
|
|
CDP
Starting Member
2 Posts |
Posted - 2008-10-16 : 13:26:13
|
| If you want the results ontop of oneanother, as if they were coming back from one query, and if they all return the same number of columns and datatypes, you should use a UNION instead of a join.Chris.DBA @ The Pythian Groupwww.pythian.com |
 |
|
|
shm
Yak Posting Veteran
86 Posts |
Posted - 2008-10-17 : 00:51:38
|
| hi thank u for replyi tried as above mentioned but am getting error..the sp is like thisCREATE PROCEDURE QPM_Main_Proc (@PRJ_SEQ_NO INT,@FROM_DATE DATETIME,@TO_DATE DATETIME)ASSELECT I_Time,Effort_On_DPFROMSELECT * FROM OPENROWSET('EXEC QPM_Idle_Time @PRJ_SEQ_NO ,@FROM_DATE ,@TO_DATE')UNION SELECT * FROM OPENROWSET ('EXEC QPM_Dp_Effort @PRJ_SEQ_NO ,@FROM_DATE ,@TO_DATE') |
 |
|
|
|
|
|
|
|