freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Patrick Muldoon" <doon AT inoc.net>
- To: "'TDS Development Group'" <freetds AT franklin.oit.unc.edu>
- Subject: Re: What SQL syntax can I use with FreeTDS?
- Date: Mon, 22 Jul 2002 15:37:16 -0400
What I normally do is put a print statement right before the execute, so
I can see exactly what I am passing in.
my $a1 = "This";
> > > my $a2 = $dbh->quote( "SELECT COUNT(*) FROM this_table WHERE
> > > this_column >= $a1" );
print $a2 . "\n";
> > > my $sth = $dbh->prepare( $a2 );
> > > $sth->execute() or die $sth->errstr;
> >
--
Patrick Muldoon, Network/Software Engineer
INOC, LLC
doon AT inoc.net
(A)bort, (R)etry, (I)nfluence with large hammer?
> -----Original Message-----
> From: bounce-freetds-134458 AT franklin.oit.unc.edu
[mailto:bounce-freetds-
> 134458 AT franklin.oit.unc.edu] On Behalf Of Peppi Vecchio
> Sent: Monday, July 22, 2002 3:32 PM
> To: TDS Development Group
> Subject: [freetds] Re: What SQL syntax can I use with FreeTDS?
>
> Bob,
>
> Thanks for the reply and the help. Unfortunately, I've tried every
> combination of single, double and no quotes in and around everything
in
> this piece of script. The most common error is:
>
> Incorrect syntax near 'a2'.
>
> I found the '$dbh->quote' working when I needed to do 'INSERT INTO'
and it
> works well in other scripts. How do I do a simple SELECT with a
variable
> such as $a2?
>
> >
> > > I'm used to using DBI and MySQL but the syntax in DBD::Sybase/SQL
> > > Server is different. Am I to use Sybase syntax or SQL Server 7.0
> > > syntax? Specifically I have difficulty passing a string into my
> > > SELECT query.
> > >
> > > my $a1 = "This";
> > > my $a2 = $dbh->quote( "SELECT COUNT(*) FROM this_table WHERE
> > > this_column >= $a1" );
> > > my $sth = $dbh->prepare( $a2 );
> > > $sth->execute() or die $sth->errstr;
> >
> > I'll bet not even MySQL lets you get away with "WHERE col >= This"
> > when you mean "WHERE col >= 'This'." You're mixing up placeholders
with
> > Perl string interpolation. Put single quotes around $a1 inside the
> > argument to $dbh->quote().
> >
> > --
> > Bob Kline
> > mailto:bkline AT rksystems.com
> > http://www.rksystems.com
>
> ---
> You are currently subscribed to freetds as: [doon AT inoc.net]
> To unsubscribe, forward this message to leave-freetds-
> 134458Q AT franklin.oit.unc.edu
-
What SQL syntax can I use with FreeTDS?,
Peppi Vecchio, 07/22/2002
- <Possible follow-up(s)>
- Re: What SQL syntax can I use with FreeTDS?, Bob Kline, 07/22/2002
- Re: What SQL syntax can I use with FreeTDS?, Peppi Vecchio, 07/22/2002
- Re: What SQL syntax can I use with FreeTDS?, Patrick Muldoon, 07/22/2002
- Re: What SQL syntax can I use with FreeTDS?, Bob Kline, 07/22/2002
- Re: What SQL syntax can I use with FreeTDS?, Peppi Vecchio, 07/23/2002
Archive powered by MHonArc 2.6.24.