Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Hw to execute stored procedure using select statement? Expand / Collapse
Author
Message
Posted Wednesday, May 8, 2013 6:40 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, July 22, 2013 5:46 AM
Points: 6, Visits: 24
I have execute my stored procedure using a select statement like
Exec SP where select * from view,wt is the finall out put of this query can some one tell me the answer,,
And one more thing is have to manipulate the Temprory tables,Is it manipulate the temprory tables ,but how some one tell me the answer with an example
Post #1450526
Posted Wednesday, May 8, 2013 6:57 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, August 26, 2014 5:30 AM
Points: 811, Visits: 1,165
I think you should use Table Valued Parameter. The below link has examples in it too.

http://blog.sqlauthority.com/2008/08/31/sql-server-table-valued-parameters-in-sql-server-2008/
Post #1450535
Posted Wednesday, May 8, 2013 7:08 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 5:47 PM
Points: 12,910, Visits: 32,020
nareshmsbi13 (5/8/2013)
I have execute my stored procedure using a select statement like
Exec SP where select * from view,wt is the finall out put of this query can some one tell me the answer,,
And one more thing is have to manipulate the Temprory tables,Is it manipulate the temprory tables ,but how some one tell me the answer with an example


you will need to create a temporary table to capture the stored proc results: you have to know the datatypes to build your table beforehand:
CREATE TABLE #tmp(
view varchar(30),
wt varchar(30) )

--insert the results into the properly shaped temp table
INSERT INTO #tmp
EXEC pr_MyProcedure @Param = 42

SELECT * FROM #tmp



Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1450542
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse