If you are talking about cursors in T-SQL, such as in a stored procedure, it would be much more effiecient to insert the results of the query used to create the cursor into a temporary table. There is no need to use a cursor for this.
Rather than declaring the cursor
DECLARE tbl_cursor CURSOR
FOR SELECT col1, col2, col3, col4 FROM tbl
and then writing code to insert records to a temporary table, just insert directly into the temporary table.
SELECT col1, col2, col3, col4
INTO #temp FROM tbl
Of course, you can fetch the cursor data and insert.
Create table #temp(col1 char(6), col2 int, col3 int, col4 datetime)
DECLARE tbl_cursor CURSOR
FOR SELECT col1, col2, col3, col4 FROM tbl
OPEN tbl_cursor
FETCH NEXT FROM tbl_cursor INTO @col1, @col2, @col3, @col4
WHILE @@FETCH_STATUS = 0
BEGIN
Insert #temp(col1,col2,col3,col4)
Values(@col1,@col2,@col3,@col4)
FETCH NEXT FROM tbl_cursor INTO @col1, @col2, @col3, @col4
END
CLOSE tbl_cursor
DEALLOCATE tbl_cursor
Terry
Neither success nor failure is ever final. -Roger Babson