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: "Lee Falkenhagen" <falkenl at hotmail dot com>
Subject: Getting Row Counts using sql() and transaction management
Date: May 14 1998 3:13PM

I am using the sql command to execute several update statements based 
upon data I read from a file.  The file is a tab-delimited file that I 
read in and create a update statement for each row based upon a key that 
is defined from the first five values in the file.

Because each row in the file is a separate update statement, I need to 
track how many rows I have processed.  My idea is to declare a variable 
and just increment it as each statement is processed.

My question is this:  how does sql determine if an error occurs if you 
are batching statements together.  In theory, I should be able to use 
begin tran and commit tran to make sure it is all or nothing.  Do I make 
separate sql calls with begin tran/rollback/commit?

Also, sql returns the result set in an array.  Is there a way to get 
@@rowcount from it.  I saw in the document about DBCOUNT, but, that does 
not seem to work with sql...

Or should I just use sql for select statements?


Lee Falkenhagen
Certified Sybase Professional

Get Your Private, Free Email at