Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: WHERE SQL clause


From   Alberto Tosetto <[email protected]>
To   [email protected]
Subject   Re: st: WHERE SQL clause
Date   Tue, 04 Feb 2003 08:35:27 +0100

Dear Kevin,

  thank you vey much, it worked (we are running Interbase 6.0 as SQL
server).

Alberto Tosetto

Divisione di Ematologia             Department of Hematology
Ospedale S. Bortolo                 S. Bortolo Hospital
via Rodolfi                         via Rodolfi
36100 Vicenza                       36100 Vicenza
Italia                              Italy


Kevin Turner wrote:
> 
> Alberto Tosetto, M.D. <[email protected]> wrote:
> 
> >I am having a problem with the odbc command on Stata 8.0. When I use
> >the exec("...") option in the odbc load command, everything works fine
> >provided that the SQL WHERE statement does not address VARCHAR values.
> >For instance, if I try the following SQL statement
> >
> >SELECT * FROM MYTABLE, WHERE GENDER="F"
> >
> >Stata gives me back the following message: table() or exec() is required
> 
> The short answer is to use single quotes for any quoted value in your SQL
> statement.
> 
>         SELECT * FROM MYTABLE, WHERE GENDER='F'
> 
> Most ODBC Drivers, and the SQL servers they connect to, actually prefer single
> quotes within SQL commands. All SQL servers we have tested take both single
> and double as interchangeable. The Stata command line parser, however, does
> not identify double quotes as valid syntax at this time so you will be required
> to use single quotes.
> 
> In the near future Stata will most likely either 1) support double quotes in
> a way that is compatible with all SQL servers, or 2) display a better error
> message if the Stata parser doesn't support double quotes.
> 
> --Kevin
> [email protected]
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index