Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Inserting resultset of a query into a table

$
0
0

I need to insert data from a sql script into a table. The query has multi select statements and declare and can have any sql statement. Simply I need to take the sql script from a user and insert into a table.

Example of input query:

declare @variable1  int = 1
select * into #temp
from table1
where column1 = @variable1

select * from #temp
except
select * from table2


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>