Here is as sample of implementing cursor.
In some cases my tests showed that this approach performs better than native cursors in SQL Server.
All you have to do is move the dataset into a temp table with a new Identity column and then use a simple loop to extract the data as you would do normally in a cursor.
The major downside of this approach is using it with a large table.
There are couple of ways to create a temp table, you can do it with SELECT INTO, INSERT INTO, Table variable in SQL 2000.
Again each one of theese methods has it's own disadvantages based on the task, with Insert into table has to be created before the data is moved.
Bellow is an example of SELECT INTO implementation
Creating a PDF from a Stored Procedure in SQL Server
A short but interesting article, the author has figured out a way to create a PDF from a stored procedure without using a third party library.
2019-09-20 (first published: 2003-08-26)
73,142 reads