Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Jim Anderson <jander at ml dot com>
Subject: Re: Join ProblemB
Date: Oct 8 1997 1:16PM sagely stated:
> I'm having trouble with the syntax of a join. SybPerl doesn't care
> for the 2nd dbcmd() I issue it:
> $dbproc =  Sybase::DBlib->dblogin($_[0],$_[1],"SIGHBASE");
> $dbproc->dbuse('MyDB');
> $dbproc->dbcmd("select distinct * from PHASCII, PHPASSWD\n");
> #this is a problem line
> $dbproc->dbcmd("where lower(PHASCII.firstname) like \"%$fname\"");
> $dbproc->dbcmd("and PHASCII.firstname *= PHPASSWD.firstname");
                  ^ (needs whitespace before here)
> $dbproc->dbcmd("and PHASCII.lastname *= PHPASSWD.lastname");
                  ^ (needs whitespace before here)
> $dbproc->dbcmd("order by PHASCII.department");
                  ^ (needs whitespace before here)
> $dbproc->dbsqlexec;
> $dbproc->dbresults;

As someone else already suggested, it's usually best to build the
entire query string in a variable first; then if there's a problem you
can print the variable to view the actual query.

> And it spits:
> Msg 102, Level 15, State 1
> Line 2
>         Incorrect syntax near 'PHASCII'.
> DB-Library error:
>         General SQL Server error: Check messages from the SQL Server.
> I've tried renaming the calls to the table to dbo.PHASCII and so forth,
> but no go. I tried escaping the parenthesis, all to no avail.
> Anybody have any ideas?
> --
> Daniel G. Drumm -
> Rush Presbyterian St. Luke's Medical Center - Chicago, IL
> Network Division - Information Services
Jim Anderson
				(212) 449-1598