Up Prev Next
From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: Re: Accessing @@rowcount global variable
Date: Jul 21 1998 3:45PM
Simon Yaminian writes:
> > Simon Yaminian writes:
> > > Hello,
> > >
> > > The number of rows affected by a query is reflected in the @@rowcount
> > > global variable. Is this variable accessible through Sybperl and if it is
> > > how?
> > In DBlib is DBCOUNT().
> > In CTlib it's
> > $rows = $dbh->ct_res_info(CS_ROW_COUNT);
> I tried using the DBlib version, DBCOUNT() right after the
> call and it returned -1. The dbsqlexec call was issued after building
> the query as a batch of commands using multiple dbcmd calls. Is this a
> permissible scenario for using DBCOUNT()?
@@rowcount (and hence DBCOUNT()) only return valid data for a SELECT
operation *after* all the rows have been processed. This is the normal
behaviour (and is the same on other SQL servers, such as Oracle).
Michael Peppler -||- Data Migrations Inc.
firstname.lastname@example.org -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com