perl@1983 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Is it possible to retrieve metadata (e.g. field data type, length etc) using syb_nsql (in DBD::Sybase). PS: I know that using prepare/execute calls, it is possible, but I have to use syb_nsql. Thanks.

Replies are listed 'Best First'.
Re: Extract metadata using syb_nsql
by Corion (Patriarch) on Nov 09, 2010 at 21:16 UTC

    See the DBI documentation about the Catalog Methods. Also read whatever documentation comes with DBD::Sybase in as much it supports these functions.

Re: Extract metadata using syb_nsql
by derby (Abbot) on Nov 09, 2010 at 22:18 UTC

    Have you tried:

    my @metadata = $dbh->syb_nsql( 'sp_help tablename', 'HASH' );

    Sure the fact that sp_help prints to STDOUT (or is it STDERR) leads to some funky output that can easily be ignored (or write your own error callback), but all the metadata should be there.

    -derby
      This doesn't seem to capturing proper results from sp_help . I am doing below: my $sql = "sp_help master"; my @arr = $dbhndl->($sql,"HASH"); print keys %$arr; Any idea if I am doing anything wrong over here?