Nope, same results, Here is a simple example:

Is the syntax invalid?

use DBI; 
my $dbh = DBI->connect('dbi:ODBC:somedb','',''); 
my $qs = $dbh->quote( "SELECT \"Rows returned: \" ");
$dbh->do($qs);
print $dbh->errstr;

---RESULT---
DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver][SQL
Server]Invalid column name 'Rows returned: '. (SQL-42S22)


-----Original Message-----
From: David Goodman [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 18, 2005 6:03 PM
To: dbi-users@perl.org
Subject: Re: Double quotes in select statement throw an error


Use DBI's quote:

my $statement = dbh->quote("SELECT \"Rows inserted\" +
@rows");

regards,

David

--- "Moosmann, James"
<[EMAIL PROTECTED]> wrote:

> The following line produces and error in DBI
> excuting with either a do or a
> prepare, execute
> 
> my $statement = "SELECT \"Rows inserted\" + @rows
> "); # ODBC error
> my $statement2 = "SELECT 'Rows inserted' + @rows ");
>  # works
> 
> $dbh->do( $statement );
> 
> or
> 
> $sth->prepare( $statement );
> $sth->execute();
> 
> DBI: 1.46
> DBD-ODBC: 1.11
> 
> Active State Perl 5.8.3 multi-thread
> Win2K
> 
> The error:
> 
> DBD::ODBC::db do failed: [Microsoft][ODBC SQL Server
> Driver][SQL
> Server]Invalid column name 'Rows inserted: '.
> (SQL-42S22)
> [Microsoft][ODBC SQL Server Driver][SQL
> Server]Invalid column name 'Rows
> inserted: '. (SQL-42S22)(DBD: Execute immediate
> failed err=-1) at
> c:/Cw/Dev/Library/Executables/sptool line 215,
> <$fileHandle> line 211.:
> 
> 
> MSSQL isql and Embarqadero do not complain about the
> double quotes.
> 
> This is in a stored procedure, the text of which we
> are trying to run.
> Other tools do not complain about the double quotes,
> only DBI.
> 
> Any ideas?  Is this a bug? Or, is it simply
> incorrect for the user to be
> using double quotes (ie, not ANSI ? )
> 
> Thanks,
> 
> James
> 
> 

Reply via email to