From:                   "Jacob Kuntz" <[EMAIL PROTECTED]>
Date sent:              Tue, 22 May 2001 15:57:19 -0400
To:                     [EMAIL PROTECTED]
Subject:                table info question

> I am trying to find a portable way to learn about the columns in a table.
> Showing my MySQL roots, I first tried to use $dbh->prepare("SHOW FIELDS FROM
> $table"). When trying to connect to MS SQL, I discovered that "show
> fields..." is mysql-specific. What is the Right Way to do this?

prepare and execute a SELECT-statement on $sth and say

my @fields = @{$sth->{NAME}};

and here you are.

See also the statement handle attributes chapter in the DBI 
documentation. I assume, BTW, that some of the database handle 
attributes will be also interesting for you, like $dbh->tables or $dbh-
>table_info etc..

Bodo
Dr. med. Bodo Eing
Institut fuer Medizinische Mikrobiologie
Klinische Virologie
v.-Stauffenbergstr. 36
48151 Muenster
Germany

Phone: ++49 251 7793 156 Fax: ++49 251 7793-104

Reply via email to