ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Insert results of Stored Procedure into Temporary Table in SQL Server<p>Hey <a class="username" rel="chetan"> chetan</a>,</p> <p>Please refer below sample query.</p> <p><span style="text-decoration: underline;"><strong>SQL</strong></span></p> <pre class="brush: sql">CREATE PROCEDURE TempDetailsInsert @Name VARCHAR(150), @Country VARCHAR(250) AS BEGIN INSERT INTO Customers(Name,Country) VALUES(@Name,@Country) SELECT Name, Country FROM Customers END GO CREATE TABLE #temp ( Name VARCHAR(150), Country VARCHAR(250) ) INSERT INTO #temp EXEC TempDetailsInsert &#39;Test&#39;,&#39;Test&#39; SELECT * FROM #temp DROP TABLE #temp</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/264789/Insert-results-of-Stored-Procedure-into-Temporary-Table-in-SQL-Server/https://www.aspforums.net:443/Threads/264789/Insert-results-of-Stored-Procedure-into-Temporary-Table-in-SQL-Server/Tue, 29 Jan 2019 03:09:09 GMTInsert results of Stored Procedure into Temporary Table in SQL Server<p>This worked for me.</p> <pre class="brush: sql">ALTER procedure [dbo].[insertpropertylisting] @propertyname varchar(150), @propertyaddress varchar(250), @propertyprice money, @availableunits varchar(100), @propertyid int OUTPUT as BEGIN &nbsp; insert into propertylisting ( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; propertyname, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; propertyaddress, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; propertyprice, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; availableunits) &nbsp;&nbsp;&nbsp; OUTPUT &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inserted.propertyname, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inserted.propertyaddress, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inserted.propertyprice, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inserted.availableunits, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inserted.property_id &nbsp;&nbsp;&nbsp; values( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @propertyname, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @propertyaddress, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @propertyprice, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @availableunits) END Create table #propertylisting ( &nbsp;&nbsp;&nbsp; propertyname varchar(150), &nbsp;&nbsp;&nbsp; propertyaddress varchar(250), &nbsp;&nbsp;&nbsp; propertyprice money, &nbsp;&nbsp;&nbsp; availableunits varchar(100), &nbsp;&nbsp;&nbsp; propertyid int ) Insert into #propertylisting ( &nbsp;&nbsp;&nbsp; propertyname, &nbsp;&nbsp;&nbsp; propertyaddress, &nbsp;&nbsp;&nbsp; propertyprice, &nbsp;&nbsp;&nbsp; availableunits, &nbsp;&nbsp;&nbsp; propertyid) Exec [dbo].[insertpropertylisting] Drop table #propertylisting</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/264789/Insert-results-of-Stored-Procedure-into-Temporary-Table-in-SQL-Server/https://www.aspforums.net:443/Threads/264789/Insert-results-of-Stored-Procedure-into-Temporary-Table-in-SQL-Server/Tue, 29 Jan 2019 21:38:50 GMT