Cursor causing memory leaks?
Posted on 2006-06-05
I have a co-worker that is anti-microsoft, and he's been sending out emails complaining that his stored procedures are causing memory leaks in SQL Server.
I looked at all the stored procedures, and they all have me a bit worried...
Look below, here is what is being done, notice the cursor is being declared/exec using an exec() statement, which worries me. Is this a bad practice? Is this bad generally. Can someone point me to something that says this is an awful way of doing things?
--cursor below, likely syntactically incorrect because I removed company related items
SET @execstr = '
declare rs cursor for
SELECT blah blah blah
FROM OPENROWSET(''MSDASQL'',''DSN='+ @DSN +''',''select * from some_other_db''')'
fetch next from rs
--usual cursor iteration stuff