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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 t-sql 2008 r2 load data obtained from stored proce

Author  Topic 

jassie
Constraint Violating Yak Guru

332 Posts

Posted - 2014-05-08 : 17:22:53
I would like to know if the following sql can be used to obtain specific columns from calling a stored procedure with parameters:


/* Create TempTable */
CREATE TABLE #tempTable (MyDate SMALLDATETIME, IntValue INT)
GO
/* Run SP and Insert Value in TempTable */
INSERT INTO #tempTable (MyDate, IntValue)
EXEC TestSP @parm1, @parm2




If the above does not work or there is a better way to accomplish this goal, please let me know how to change the sql?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-05-08 : 17:30:28
The temp table definition has to match the stored procedure output. If the stored procedure is returning 100 columns, then the temp table needs to have 100 columns.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -