Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does SQL Server 7.0 support Nested cursor ?

Status
Not open for further replies.

sachinagarwal

Programmer
Feb 5, 2001
4
IN
I m using PB7.0 and SQL Server 7.0 and I nee the help urgently. In my current application which is in PB5.0 and Sybase, I have to convert it in PB7 and SQL Server7.0 and I m using nested cursor in my original application sucessfully. But I do't know that does SQL Server7.0 support nested cursor. If it is the pls tell me immidiately.
 
what if you use datawindows instead of cursors? This tip i´m using for years. Is ultrafast and safe, just take care of locking if you are using isolation level "RC"

dw_1.settransobject(sqlca)
dw_1.retrieve()

for ll_row=1 to dw_1.rowcount()
ls_item = dw_1.getitemstring(ll_row,'item')

dw_2.retrieve(ls_item)
for ll_row2 = 1 to dw_2.rowcount
price = dw_2.getitemnumber(ll_row2,'price')
... some code ...
next

next

 
I m thankful to know the solution. But this is v. costly solution b'caz in this method no. of objects and the memory utilisation will be increased and I think this is a temporary soln.

But I want to know that whether I can use nested cursor with SQL Server 7.0.
Any way thanks a lot for responding my question.
 
I have a problem when i want to use nested cursor and i found this.

declare the first cursor, then declare the second and when you close the second cursor deallocate it

ex
declare first_cursor cursor for
select * from ff

open first_cursor

fetch first_cursor into @gg

while (@@sqlcode=0)
begin
declare second_cursor cursor for
select * from ss

open second_cursor

fetch second_cursor into @gg

while (@@sqlcode=0)

fetch second_cursor into @gg

loop
close second_cursor
deallocate second_cursor

fetch first_cursor into @gg

loop
close first_cursor

it works on sybase




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top