Re: Double quotes in select statement throw an error

2005-01-22 Thread Jonathan Leffler
On Tue, 18 Jan 2005 16:10:52 -0500, 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

RE: Double quotes in select statement throw an error

2005-01-19 Thread amonotod
> From: "Moosmann, James" <[EMAIL PROTECTED]> > Date: 2005/01/19 Wed AM 08:24:12 CST > Does anyone know how to check/set this attribute using DBI so I don't have > to instruct a user on changing his DSN? ( I don't see this option mentioned > in DBD::ODBC ) Might I suggest using DSN-less connecti

RE: Double quotes in select statement throw an error

2005-01-19 Thread Jeff Urlwin
> > Thank you everyone who responded and to Tim and Jeff: > > The reason the server generates an error is because there are > 2 flags which can be set when you create the DSN: > > Use ANSI quoted identifiers > Use ANSI null, padding and warning > > And they were both selected. > > De-select

RE: Double quotes in select statement throw an error

2005-01-19 Thread Moosmann, James
Thank you everyone who responded and to Tim and Jeff: The reason the server generates an error is because there are 2 flags which can be set when you create the DSN: Use ANSI quoted identifiers Use ANSI null, padding and warning And they were both selected. De-selecting "Use ANSI null, paddin

RE: Double quotes in select statement throw an error

2005-01-19 Thread Jeff Urlwin
ost.Net [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 18, 2005 6:49 PM > To: dbi-users@perl.org > Subject: Re: Double quotes in select statement throw an error > > > > > Moosmann, James wrote: > > Nope, same results, Here is a simple example: > >

Re: Double quotes in select statement throw an error

2005-01-19 Thread Tim Bunce
On Tue, Jan 18, 2005 at 11:22:58PM -0500, Moosmann, James wrote: > Perl DBI thinks any double quoted string must be a column > or table name ( [ and ] are preferred, but double quotes are still > acceptable). Not true. Neither the DBI nor the driver (generally) parse the SQL. The DBI gives it to t

Re: Double quotes in select statement throw an error

2005-01-18 Thread JupiterHost.Net
Moosmann, James wrote: Lee, Hello, The select statement is very valid and so is: SELECT 'Hello World!' as 'My first SQL Statement' -or- SELECT answer = 2+3 Really, try it. ok, but if you $dbh->quote() it, it becomes something like: 'SELECT \'Hello World!\' as \'My first SQL Statement\'' literal

RE: Double quotes in select statement throw an error

2005-01-18 Thread Moosmann, James
MAIL PROTECTED] Sent: Tuesday, January 18, 2005 6:49 PM To: dbi-users@perl.org Subject: Re: Double quotes in select statement throw an error Moosmann, James wrote: > Nope, same results, Here is a simple example: > > Is the syntax invalid? > > use DBI; > my $dbh = DBI->connect(&

Re: Double quotes in select statement throw an error

2005-01-18 Thread JupiterHost.Net
Moosmann, James wrote: 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: \" "); Why are you quoting the entire query as a string? $dbh->do($qs); Use a valid query: $dbh->do

RE: Double quotes in select statement throw an error

2005-01-18 Thread Rutherdale, Will
dman' Cc: dbi-users@perl.org Subject: RE: Double quotes in select statement throw an error 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

RE: Double quotes in select statement throw an error

2005-01-18 Thread Ronald J Kimball
David Goodman [mailto:[EMAIL PROTECTED] wrote: > > Use DBI's quote: > > my $statement = dbh->quote("SELECT \"Rows inserted\" + > @rows"); This is not at all how quote() is meant to be used. quote() is for quoting a single value for interpolation, not an entire SQL statement. For example: m

RE: Double quotes in select statement throw an error

2005-01-18 Thread Moosmann, James
D::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 quo

Re: Double quotes in select statement throw an error

2005-01-18 Thread David Goodman
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\" + @