in reply to RE: Re: Field names of database table from DBI
in thread Field names of database table from DBI

SHOW COLUMNS FROM $table should also work
#!/usr/bin/perl # connect to db my $dbh = DBI->connect(bla..bla..bla); my $sql_q = "SHOW COLUMNS FROM $table"; my $sth = $dbh->prepare($sql_q); $sth->execute; while (@row = $sth->fetchrow_array){ print"Field Type Null Key Default Extra\n"; print"----------------------------------------------------\n"; print"$row[0] $row[1] $row[2] $row[3] $row[4] $row[5]\n"; }

Replies are listed 'Best First'.
RE: RE: RE: Re: Field names of database table from DBI
by gregorovius (Friar) on Aug 09, 2000 at 06:36 UTC
    This is database dependant. It won't work for MS SQL through the DBD::ODBC driver, for instance.