PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: listing tables from within DBD::Sybase
Date: Sep 27 2001 8:28PM

Edward J. Sabol writes:
 > Ed Phillips asked:
 > > I have a question that I did not see addressed in the docs.
 > > I've got a remote database I'm working with. Is there a
 > > command callable from DBD::Sybase that will give me a list of
 > > the tables in my database; does this command also work on
 > > MSSQL databases?
 > 
 > Dennis Hanson:
 > >> You will probably have to do a select from the
 > >> sysdatabases table, like so:
 > >>
 > >> select name from sysdatabases order by name
 > >>
 > >> I don't think DBD-Sybase has a specific command or routine
 > >> that returns table names.
 > 
 > Of course it does. Please refer to the table_info method of the DBI
 > documentation ("perldoc DBI").
 > 
 > my $dbh = DBI->connect(...);
 > my $sth = $dbh->table_info;
 > my $array_ref = $sth->fetchall_arrayref;

Indeed - but as I mentioned elsewhere this uses the sp_tables
"catalog" stored procedure. If MSSQL doesn't include the same proc, or
if it is substantially different in functionality then this might not
work correctly.

Michael
-- 
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
mpeppler@peppler.org - mpeppler@mbay.net
International Sybase User Group - http://www.isug.com