Skip to Content.
Sympa Menu

freetds - Re: Handling of Sybase column names

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT ais.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Handling of Sybase column names
  • Date: Tue, 29 Jan 2002 20:10:44 -0500 (EST)


FreeTDS does not manipulation of the SQL text prior to sending it to the
server, except in the case of TDS 7.0 an ascii string is converted to
unicode when submitted. The content is not changed however.

you may want to try something like

SELECT "Date" from "Table"

and there is a way to turn strict ansi compliance on (escapes me at the
moment). But long story short, ANSI defines " and ' as different things.
' (single quote) is used for string literals whereas " (double quote) is
used for identifiers such as tables/columns with spaces in them, eg
SELECT "My Column" FROM "My Table With Spaces in the Name"

So double quotes with ansi compliance turned on may work.

Brian

On Tue, 29 Jan 2002, Shrock, Court wrote:

> Here is my problem:
>
> The database that I need to access has table names that are normally
> reserved--ie, "Date", "Bit", etc...I would like to be able to pass the query
> "SELECT Date FROM Events" or "SELECT * FROM Events ORDER BY Date", but the
> response acts as though it thinks Date is a function (I know one does exist,
> but I want to refer to the column name, not the function). I know this
> because I get an error about wrong number of parameters with the query
> "SELECT Date() FROM Events". Any ideas?
>
> Does freetds do any manipulating of the query string before it sends it to
> the server listed in the freetds.conf?
>
> I can "SELECT * FROM Events" and the Date column is returned, but my problem
> is that how can one include reference to "Date" in the WHERE, GROUP, and
> ORDER portions of the query? Incidently, the "SELECT * FROM Events" returns
> the data that I need--connectivity is not a problem.
>
> I am accessing the database via PHP-4.1.1/freeTDS-0.53 on linux-2.2.19.
>
> Many thanks,
> Court
>
>
> ---
> You are currently subscribed to freetds as: [camber AT ais.org]
> To unsubscribe, forward this message to $subst('Email.Unsub')
>





Archive powered by MHonArc 2.6.24.

Top of Page