in reply to How do you get Perl::DBI to do a desc table_name?
Most databases have system tables that contain that information. You'll have to consult your documentation. However, to find just the fieldnames from a table, this hack should do it (though I probably wouldn't use something like this):
my $dbh = DBI->connect( $connection,$user, $pass,{RaiseError => 1}); my $sql = 'SELECT TOP 1 * FROM someTable'; my $sth = $dbh->prepare( $sql ); $sth->execute; my $fields = $sth->fetchrow_hashref; $sth->finish; my @fields = keys %$fields;
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
In Section
Seekers of Perl Wisdom