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

avoiding using a temp table in a stored procedure

$
0
0

Can I write a stored procedure that does INSERTs into the resultset of the stored procedure instead of having to use a temp table and then doing a SELECT of the records in that temp table ? 

Specifically I need to return a resultset containing  datetime values from a range of dates, but omitting weekend days and holidays where holidays are defined in a table in the database.    

Right now there is a WHILE loop that INSERTs into a temp table and then at the end of the stored procedure there is this

SELECT * FROM #TEMPTABLE
DROP TABLE #TEMPTABLE


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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