October 27, 2014 at 4:29 am
Folks,
I have an Urgent requirement like i have two SP's ,SP1,SP2 .SP1 have one parameter, SP2 have two parameters,I need to merge these two sp's and need result in a single shot.PLease can you please help me out it's an urgent requirement and iam new to SP
SP1 - @User Varchar(15)
SP2 - @id1 int,@id2 int
Result SP => SP1 + SP2
Thanks,
Frank
October 27, 2014 at 4:31 am
That's a bit of a vague question.
Do you need to merge them permenantly, or do you still need SP1 and SP2 seperately?
Or do you just need this one resultset for one ad-hoc request?
What do the stored procedures do? What do they return?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
October 27, 2014 at 4:37 am
Hi ,
I need to merge for one more ad-hoc report thats why, the both SP remains same for another functionality but i need to merge these two SP's to generate Adhoc report
Thanks,
Frank
October 27, 2014 at 4:39 am
Hi,
SP1 => returns some 15 columns
SP2 => returns some 25 columns
I need Result SP => SP1+ SP2 => which should combine all these columns and returns 40 columns totally
Thanks,
Frank
October 27, 2014 at 4:44 am
I would insert the result sets from both SPs in temporary tables and then simply join them together.
INSERT INTO #temp1
EXEC SP1;
INSERT INTO #temp2
EXEC SP2;
SELECT *
FROM #temp1
JOIN #temp2 ON ...
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
October 27, 2014 at 4:45 am
Create two temp tables. Insert the results of SP1 into one of them, insert the results of SP2 into the second, then write a query that joins them on whatever the unique join columns are and returns the data needed for the report.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
October 27, 2014 at 4:54 am
Hi ,
Can anyone give me one sample SP Since iam new to SP
Thanks,
Frank
October 27, 2014 at 4:57 am
lefrancisco1 (10/27/2014)
Can anyone give me one sample SP Since iam new to SP
CREATE PROCEDURE (Transact-SQL)
There are examples at the bottom.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply