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: ed phillips <artlore at sirius dot com>
Subject: Re: listing tables from within DBD::Sybase
Date: Sep 27 2001 8:50PM

Michael Peppler wrote:
> 
> 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.
> 

Excellent. Thank you. That is exactly the kind of database specific
information I needed as $dbh->table_info was not working for me with
this remote MSSQL database.

Thanks again,

Ed