t-sql cursor with dynamic sql 
Author Message
 t-sql cursor with dynamic sql
Hi!

Can I open a Cursor at Runtime with a dynamic computed sql-select.

I'm looking for something like:

:

:

Thanks and Best Regards
Manfred Steyer, MCP



Mon, 26 Jan 2004 05:31:21 GMT
 t-sql cursor with dynamic sql

Hi,

Have a look at this nice code:
--------------------
use pubs
go




use pubs
go



set rowcount 1      --> lets have this for the fun of it


begin

  begin
  /*
   here we do a fetch last cursor, to get the last of a select
   top, this is not the fastest way to do it, i would have done
   a leap number column... but u asked how and this is how you
   can do it... don't blame or shame me for this :/)
  */









  end



end
set rowcount 0
------------

Henrik Yllemo
MCP, MCSD


Quote:
> Hi!

> Can I open a Cursor at Runtime with a dynamic computed sql-select.

> I'm looking for something like:

> :

> :

> Thanks and Best Regards
> Manfred Steyer, MCP



Mon, 26 Jan 2004 05:39:00 GMT
 t-sql cursor with dynamic sql
    You can use dynamic SQL like:


OPEN somecur

    Make sure you use global cursors though.

--
Umachandar Jayachandran
SQL Resources at http://www.umachandar.com/resources.htm
( Please reply only to newsgroup. )



Mon, 26 Jan 2004 06:28:19 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. TSQL, dynamic SQL and cursors?

2. cursor dynamic in tsql user defined function for sql2000

3. TSQL Dynamic Cursors Creation

4. Returning a ref cursor with dynamic SQL in PL/SQL

5. Differences between SyBase TSQL, and SQL Server 2000 TSQL

6. HOW TO create cursor from dynamic SQL statement (EXECUTE(@Statement))

7. cursor and Dynamic SQL

8. declare cursor with Dynamic sql statement in store procedure

9. Selecting into cursor using dynamic SQL

10. Dynamic SQL within a cursor loop inside a stored procedure

11. Cursors with dynamic SQL stmnt

12. Cursor on Dynamic SQL


 
Powered by phpBB® Forum Software