Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: syntax to access irregular field names


Message #1 by "Carl Schwarcz" <carl@s...> on Tue, 3 Dec 2002 01:06:37
Are you sure you can't do it as:

String query = "SELECT ContactID FROM ConLang WHERE ConLang.[Speak?]=7;";

or

String query = "SELECT ContactID FROM ConLang WHERE
ConLang.\"[Speak?]\"=7;";

The [] needs to be sent to the Jet engine for processing...

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Carl Schwarcz" <carl@s...>
Subject: [sql_language] Re: syntax to access irregular field names


: (corrected typing)
:
: Sorry to ask a beginner's question but I am trying to use JDBC and the
: JDBC-ODBC bridge to access a Access 2002 .mdb file.
:
: Unfortunately a few of the tables have column names that end in question
: mark ("?") such as a columns called "Speak?".
:
: I can use SQL in Access 2002 to reference this field as [Speak?] as in
: SELECT ContactID FROM ConLang WHERE ConLang.[Speak?]=true;
:
: I've tried the following using JDBC:
:
: String query = "SELECT ContactID FROM ConLang WHERE ConLang.\"Speak?
: \"=7; ";
:
: JDBC returns an error for this query complaining about "too few
: parameters".
:
: I don't want to rename the fields as the schema isn't mine.  Is there any
: way to work around the use of question mark in the field name or escape it
: so that it is not interpreted as a paramater?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  Return to Index