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: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: question.
Date: Jul 16 2004 5:26AM

This would probably be better asked in


On Fri, 2004-07-16 at 03:59, Durairaj K. Avasi wrote:
> 1. In Sybase how i can find whether a table is locked or not?

sp_lock will tell you what locks are held. In most cases locks are held
for portions of the table, not the entire table. You can look at the
source code for sp_lock (use sybsystemprocs - sp_helptext sp_lock) to
see which tables need to be queried to get the information on whether
any locks are held for a particular table.
> 2. How i can enforce table T to use index I?

select ... from T (index I) where ...
> 3. In sybase how i can find all indexes associated to a table?

sp_helpindex tablename.

> 4. If table a has 9 million records. among 9 million 8 million records
> have "stateName" column value equal to "NY". What is the best way to
> delete all these 8 million record.?

Depends on your situation.

The *fastest* would probably be to copy out all the rows that are NOT
"NY", truncate the table, and the load the remaining rows back in.

The alternative would be to delete the rows in a loop, to avoid
overflowing the log using a set rowcount.

Michael Peppler                              Data Migrations, Inc.             
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short
or long term contract positions -