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 ««12

Returning stored procedure results into a CTE or temp table? Expand / Collapse
Posted Thursday, August 22, 2013 3:28 AM



Group: General Forum Members
Last Login: Today @ 2:09 PM
Points: 40,193, Visits: 36,597
cmerrell (8/21/2013)
But "insert into" will only insert into an existing table. What about creating a new table?


EXEC ...

Caveat is that you have to know the structure of the result set, but to be honest if you have a procedure that's non-deterministic in terms of the result set it's returning, there's probably something deeper that needs fixing/changing

Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1487133
Posted Thursday, August 22, 2013 4:06 PM


Group: General Forum Members
Last Login: Friday, October 3, 2014 5:55 AM
Points: 24, Visits: 159
The output table is the result of a dynamic pivot, so the columns created depends on the values in the data. Yes, its non-deterministic, but fairly standard practise, is it not?
Post #1487555
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse