Can't call databasepropertyex() over DBD::ODBC for MSSQL

[email protected] (Rafael Kitover)
Newsgroups perl.dbi.users
Message-ID <[email protected]>
Hello, I've noticed that DBD::ODBC with unixODBC and FreeTDS has bizarre
problems calling some stored procedures and functions in MSSQL.

Here's an example:

% echo $DBICTEST_MSSQL_DSN
dbi:Sybase:server=SQL2008
% perl -MDBI -le 'my $dbh=DBI->connect(@ENV{map "DBICTEST_MSSQL_$_", qw/DSN USER PASS/}); print for $dbh->selectrow_array("SELECT databasepropertyex(DB_NAME(), '\''Collation'\'')");'
SQL_Latin1_General_CP1_CI_AS

Here I'm using DBD::Sybase compiled against FreeTDS to call the
databasepropertyex() function, it works correctly.

The same query using DBD::ODBC compiled against unixODBC using the same
version of FreeTDS produces:

% echo $DBICTEST_MSSQL_ODBC_DSN 
dbi:ODBC:server=myhost.dyndns.info;port=5000;driver=FreeTDS;tds_version=8.0
% perl -MDBI -le 'my $dbh=DBI->connect(@ENV{map "DBICTEST_MSSQL_ODBC_$_", qw/DSN USER PASS/}); print for $dbh->selectrow_array("SELECT databasepropertyex(DB_NAME(), '\''Collation'\'')");'                                                              

this returns no result.

This is the only reliable way to detect collation (and therefore
case-sensitivity) in MSSQL 2000+ if for some reason access to
sys.databases has been blocked, so would be nice if it worked or there
was some workaround.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.