Skip to Content.
Sympa Menu

freetds - Re: What SQL syntax can I use with FreeTDS?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Peppi Vecchio" <PVecchio AT orangelake.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: What SQL syntax can I use with FreeTDS?
  • Date: Mon, 22 Jul 2002 15:32:03 -0400


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




Archive powered by MHonArc 2.6.24.

Top of Page