in reply to Field Size using FreeTDS and SQL7

I'm assuming you possibly mean the max size of a field and not the size of the data in the field (like finding out a column can contain a CHAR(255)). I'm not sure about FreeTDS or SQL Server 7 but under DBD::Sybase (they're closely relatated), you can find out this information by checking the PRECISION attribute of the statement handle - not quite as convenient as asp but ...

#!/usr/bin/perl -w use DBI; use Data::Dumper; my $dbh = DBI->connect( 'dbi:Sybase:server=name', 'user', 'pass' ); $dbh->do( "use database" ); my $sql = "select * from alertquerystring order by alert_id"; my $sth = $dbh->prepare( $sql ); $sth->execute; print "The fields returned are of type: ", Dumper( $sth->{TYPE} ); print "The fields have the following precision ", Dumper( $sth->{PRECI +SION} ); $sth->finish; $dbh->disconnect;

-derby

Replies are listed 'Best First'.
Re: Re: Field Size using FreeTDS and SQL7
by markhoy (Novice) on Mar 04, 2003 at 16:08 UTC
    I had thought it was field length but it was meant to be length of the returned data in each field. Thanks. Mark