Not unless you put all the cursor code in as dynamic SQL
i.e.
DECLARE @v_SQL VARCHAR(2000)
SET @v_SQL = 'DECLARE curUsers CURSOR FOR ' + @sSQL
SET @v_SQL = @v_SQL + 'Other code within cursor'
exec @v_Sql
"I'm living so far beyond my income that we may almost be said to be living apart
Insert results given by @sSQL into #temptable, then loop with cursor over it.
------ "There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.