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

Inserting Data to a temporary table

$
0
0

Hi,

This may sound strange, but I see code that inserts data to a temporary table, which sources from the same temporary table. The code looks like this:

-- Some code that initially inserts data to #tmpA

IF(UserId = 0)
BEGIN

INSERT INTO #tmpA
SELECT * from #tmpA

END


I'm just curious on how this code snippets would do. Would this end up to an infinite loop? The whole code runs endlessly, I don't know if it's because of the CURSOR that is being implemented, or is it because of this code snippets which probably inserts data to #tmpA endlessly?


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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