jkwood@pegasus.com (Keith Wood) (06/27/90)
Well, the good news is that I found the problem on my own. The bad news is that Sybase's error messages were rather misleading... In my actual program listing the final column specification for fieldC did not have a space following it, so the command buffer thought that I was selecting fieldCfrom. dbcmd(dbproc, "select fieldA, "); dbcmd(dbproc, "fieldB, fieldC"); <-- problem is here dbcmd(dbproc, "from tableC "); dbcmd(dbproc, "where dataKey = -1"); Why sybase then decides to report EVERY COLUMN as an 'Invalid column name' is somewhat beyond me, but that's the case... Editing out the <<dbcmd(dbproc, ">> and the <<");>> from the source file and pasting it back into the Shell running isql did not cause problems because isql treats a newline character as a space. Adding a space to the line (fieldC ") brought everything right into alignment, and things work great... Jeez, just another one of those things... Keith Wood <NeXT mail> jkwood@manana.pegasus.com <NeXT mail> next1!manana!jkwood@next.com <Voice> (808) 259-5234 <FAX> (808) 259-5652
tim@ohday.sybase.com (Tim Wood) (06/30/90)
In article <1990Jun27.023244.4648@pegasus.com> jkwood@pegasus.com (Keith Wood) writes: >Well, the good news is that I found the problem on my own. >The bad news is that Sybase's error messages were rather misleading... Or SQL syntax is misleading. SQL unnecessarily widens the gap between what one says and what one means. Your reaction is understandable, but read on: >In my actual program listing the final column specification for fieldC >did not have a space following it, so the command buffer thought that I >was selecting fieldCfrom. > dbcmd(dbproc, "select fieldA, "); > dbcmd(dbproc, "fieldB, fieldC"); <-- problem is here > dbcmd(dbproc, "from tableC "); > dbcmd(dbproc, "where dataKey = -1"); > >Why sybase then decides to report EVERY COLUMN as an 'Invalid column name' >is somewhat beyond me, but that's the case... Well, let's parse the errant query: SELECT fieldA, /* identifier */ fieldB, /* identifier */ fieldCfrom /* identifier */ tableC /* correlation variable */ WHERE dataKey /* identifer */ = /* relop */ -1 /* constant */ The identifers are treated as column names and the names are invalid because there is no table in the query (which contains those columns). It sounds like you would prefer an error message like "what you're SELECTing look an awful lot like column names but the query doesn't reference any tables." However, how long would disbelief in the assertion that there are no tables last? -TW Sybase, Inc. / 6475 Christie Ave. / Emeryville, CA / 94608 415-596-3500 tim@sybase.com {pacbell,pyramid,sun,{uunet,ucbvax}!mtxinu}!sybase!tim This message is solely my personal opinion. It is not a representation of Sybase, Inc. Ohday.