Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Ashu Joglekar <ajogleka at ltcm dot com>
Subject: Re: Accessing @@rowcount global variable
Date: Jul 21 1998 6:57PM

On a less philosophical note :-) @@rowcount is most useful inside a stored
procedure to check if an update statement worked :

update table
if (@@rowcount = 0)
    print "oops"

Or, sometimes you need to delete/update a big old table in a batch by setting
the rowcount to a small enough number that won't fill up the log and then
looping until @@rowcount = 0.

This thread reminds me of the time I asked a Sybase engineer the same question
(8 years ago). His analogy was "You want me to tell you how much money I have in
my pocket. I don't know how much I have, so I have to pull out my wallet, count
my money and then tell you how much I have. If you want me to give you all the
money, then  I have to count it while giving it to you."

Or something like that :-)