Ask a Question related to Microsoft SQL / MS SQL Server, Design and Development.
-
Andrew J. Kelly #1
Re: Why not simply WHILE @@FETCH_STATUS = 0?
It really depends on what type of cursor you use. If you use a static
cursor then you can never get anything other than a 0 since all the rows
will always be there. If you have a dynamic cursor you could attempt to
fetch a row that someone just deleted and it will fail. If your only
checking for 0 it will fail and you would most likely stop fetching assuming
they are all done. Where as if you checked for more than 0 you can be more
flexible.
--
Andrew J. Kelly
SQL Server MVP
"Bob Barrows" <reb_01501@yahoo.com> wrote in message
news:ut4$ByyRDHA.2460@TK2MSFTNGP10.phx.gbl...> SQL 6.5 BOL recommended a two-step process of making sure FETCH NEXT
> returned results:
> FETCH NEXT FROM ...
> WHILE (@@fetch_status <> -1)
> BEGIN
> IF (@@fetch_status <> -2)
> etc.
>
> The reason it gave never made sense to me: "Because @@fetch_status will
> return -2, -1, or 0, all three cases must be tested"
>
> The SQL2000 BOL examples more simply say:
>
> WHILE @@fetch_status = 0
> BEGIN
> etc.
>
> However, the cursor templates in QA revert to the two-step process. I'm
> confused: why is the 2-step process considered de rigeuer?
>
> Bob Barrows
>
>
>
Andrew J. Kelly Guest
-
quite simply
hello everybody! i am desperatly trying to set up a simple photogallery in my "homemade" website, you know. the kind of things with "next" button... -
Simply sending text?
Hello, I'm trying to send text from the server to the client. The examples provided with Flashcom are close to what I am trying to accomplish,... -
the XML Connector - I simply can't understand it
Dear people, at the moment I'm working on a page with a very very very simple goal: - get a text from an xml file into flash. Now as I may... -
VPC 6.1 Win 98 Simply Acounting and mac osX.3 acrobat ??
I'm working with that because I don't need more and don't want to spend more. just to run a accounting software. -
Probably Very simply but how?
Hi, I am very new to php and I want to display item informaion in a table, but I only want items to appear that have been ordered. I can get ... -
Bob Barrows #2
Re: Why not simply WHILE @@FETCH_STATUS = 0?
Ah, that makes sense. Many thanks.
Bob
Andrew J. Kelly wrote:> It really depends on what type of cursor you use. If you use a static
> cursor then you can never get anything other than a 0 since all the
> rows will always be there. If you have a dynamic cursor you could
> attempt to fetch a row that someone just deleted and it will fail.
> If your only checking for 0 it will fail and you would most likely
> stop fetching assuming they are all done. Where as if you checked
> for more than 0 you can be more flexible.
>
>
> "Bob Barrows" <reb_01501@yahoo.com> wrote in message
> news:ut4$ByyRDHA.2460@TK2MSFTNGP10.phx.gbl...>> SQL 6.5 BOL recommended a two-step process of making sure FETCH NEXT
>> returned results:
>> FETCH NEXT FROM ...
>> WHILE (@@fetch_status <> -1)
>> BEGIN
>> IF (@@fetch_status <> -2)
>> etc.
>>
>> The reason it gave never made sense to me: "Because @@fetch_status
>> will return -2, -1, or 0, all three cases must be tested"
>>
>> The SQL2000 BOL examples more simply say:
>>
>> WHILE @@fetch_status = 0
>> BEGIN
>> etc.
>>
>> However, the cursor templates in QA revert to the two-step process.
>> I'm confused: why is the 2-step process considered de rigeuer?
>>
>> Bob Barrows
Bob Barrows Guest
-
abdheshtech #3
Re: Why not simply WHILE @@FETCH_STATUS = 0?
Why we use "@@Fetch_status"
abdheshtech Guest



Reply With Quote

