I want to capture and increment variable across multiple select statements:
DECLARE @count INT = 0;
SELECT parent = 0, id = @count++
INTO #tmp1
FROM ...
SELECT parent = id, id = @count++
INTO #tmp2
FROM ...
Obviously ROW_NUMBER() is no good here. How I can achieve this?