Showing posts with label curcursor. Show all posts
Showing posts with label curcursor. Show all posts

Thursday, March 22, 2012

Cursor and dynamic slq

hi can we use sql dynamic query with curosr
like
set @.cur=cursor for exec(@.sql) ... some thing like thanksThis way:
SET @.sql = 'DECLARE c CURSOR FOR SELECT ... '
OPEN c
...
However, best practices is to avoid cursors as well as dynamic SQL...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"amjad" <amjad@.discussions.microsoft.com> wrote in message
news:D9D93F32-DFD3-4207-B609-1B36654CBD02@.microsoft.com...
> hi can we use sql dynamic query with curosr
> like
> set @.cur=cursor for exec(@.sql) ... some thing like thanks