Invalid cursor state when using PRINT in MSSQL
From: James Moosmann (james.moosmann_at_bankofamerica.com)
Date: 10/19/04
- Next message: Tim Bunce: "Re: Slow connection to Oracle 9i"
- Previous message: Ron Savage: "Re: Open source perl database interface GUIs for unix?"
- Next in thread: Jeffrey Seger: "Re: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: Jeffrey Seger: "Re: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: James Moosmann: "RE: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: Dan Horne: "RE: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: James Moosmann: "RE: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: James Moosmann: "RE: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: Dan Horne: "RE: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: James Moosmann: "RE: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: James Moosmann: "RE: Invalid cursor state when using PRINT in MSSQL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 18 Oct 2004 18:46:13 -0400 To: "'dbi-users@perl.org'" <dbi-users@perl.org>
I am using DBI and DBD-ODBC to connect to an MSSQL Server and this query
gets an invalid cursor state:
PRINT 'starting select'
select count(*) from anytable
PRINT 'finished'
If I only run the PRINT command... it works.
If I run the full query against a sybase server... only the top select
prints.
I am using:
Win32 AS-5.8.0 Multithread build 806 DBI(1.43)DBD::ODBC(1.07) MSSQL Server I
get a invalid cursor state when I run any SQL with a PRINT statement at the
beginning of any SQL statement.
The error:
DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver]Invalid
cursor state (SQL-24000)(DB
D: dbd_describe/SQLNumResultCols err=-1) at H:\progs\dbi_test.pl line 10.
Example code:
#c:/perl/bin/perl
use DBI;
my $dbh = DBI->connect( 'dbi:ODBC:TEST_DSN', '','', {RaiseError=> 1} );
my $sql = qq#
PRINT 'starting select'
select count(*) from anytable
PRINT 'finished'
#;
my $sth = $dbh->prepare( $sql );
my $rv = $sth->execute();
while ( my $hr = $sth->fetchrow_hashref ){
print $$hr{$_}, "\n" for ( keys %$hr );
print "Err: ", $dbh->errstr, "\n" if $dbh->errstr;
}
Does this have anything to do with how SQL_SUCCESS_WITH_INFO is being
handled by the driver?
How do I get all the results..
Thanks!
James
- Next message: Tim Bunce: "Re: Slow connection to Oracle 9i"
- Previous message: Ron Savage: "Re: Open source perl database interface GUIs for unix?"
- Next in thread: Jeffrey Seger: "Re: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: Jeffrey Seger: "Re: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: James Moosmann: "RE: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: Dan Horne: "RE: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: James Moosmann: "RE: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: James Moosmann: "RE: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: Dan Horne: "RE: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: James Moosmann: "RE: Invalid cursor state when using PRINT in MSSQL"
- Maybe reply: James Moosmann: "RE: Invalid cursor state when using PRINT in MSSQL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]