Mar 4, 2008

Passing Data from one sp to other sp using Temp Table.

Passing Data from one sp to other sp using Temp Table.

 

Hi,

Here I tried a trick, there may be others trick also to do the same.

 

 

CREATE PROCEDURE Proc_Record_Insertion

AS

-- This #Temp1 table is defined in the other sp which I am using here.

INSERT INTO #Temp1(id,info) VALUES(1,'Mohammad')

INSERT INTO #Temp1(id,info) VALUES(2,'Irfan');

INSERT INTO #Temp1(id,info) VALUES(3,'matespoint@gmail.com');

INSERT INTO #Temp1(id,info) VALUES(4,'matespoint.blogspot.com');

GO

-- This will create a sp Proc_TempTableCreate which create a Temp table and insert four recors into it.

 

CREATE PROCEDURE Proc_UseTempData

AS

BEGIN

CREATE TABLE #Temp1

            (id int,

             info varchar(40) )

 

-- Executing the sp

EXEC Proc_Record_Insertion

 

SELECT * FROM #Temp1

END

No comments:

Post a Comment

SQL - Difference between CAST,CONVERT and PARSE

TODO---