N
N
Noob_0012015-08-25 16:11:06
SQL
Noob_001, 2015-08-25 16:11:06

Can anyone explain the fetch logic to me?

open @cursor
fetch FIRST from @cursor into @str_fetch
while @@FETCH_STATUS = 0
begin
....
fetch NEXT from @cursor into @str_fetch
end
close @cursor
and
open @cursor
fetch NEXT from @cursor into @str_fetch
while @@FETCH_STATUS = 0
begin
....
fetch NEXT from @cursor into @str_fetch
end
close @cursor
I can't understand the difference :(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OlegTar, 2015-08-25
@Noob_001

If the cursor has not been fetched yet, I assume that fetch FIRST and fetch NEXT give the same result - they return the first record.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question