CandymanCID, here's somthing that reports column name.
UPDATE: added more context, because original code wasn't clear.
my @colNames;
my $sth1 = $dbh->table_info();
while (my(@tab) = $sth1->fetchrow_array()) {
push @colNames, $tab[2];
}
open OUT, ">col.txt";
foreach $colName(@colNames) {
print OUT "$colName\n";
my $sth = $dbh->column_info();
while (my @info = $sth->fetchrow_array()) {
foreach (@info) {$_ = 'NULL' unless defined $_}
if ($colName eq $info[2]) {
print OUT "\t$info[3]\n";
The DBI docs on CPAN are good, but dense. My example above should get you going...
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.