develooper Front page | perl.beginners | Postings from February 2009

DBI Placeholder Issue

Thomas Yan
February 19, 2009 23:45
DBI Placeholder Issue
Message ID:
Hi All,

I want to query the database log of SQL Server using DBI:ODBC and I
encounter a problem.

I want to use "select * from ::fn_dblog(null,null)" to query the log, but
DBI takes :: as placeholder and fails. As follows,

         use DBI;

         my $dbh = DBI->connect("dbi:ODBC:MyDSN")

                  or die "Can't connect: $DBI::errstr\n";

         my $query = qq{

                                            select * from


         my $sth = $dbh->prepare($query) ;  

         $sth->execute( ) or die $dbh->errstr;

I run the script and the output is:

Can't rebind placeholder fn_dblog at F:\zDataBase\ line 29.


How to fix it ?

Best regards!

Thomas Yan Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About