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

Re: st: WHERE SQL clause

From (Kevin Turner)
Subject   Re: st: WHERE SQL clause
Date   Mon, 03 Feb 2003 09:24:33 -0600

Alberto Tosetto, M.D. <> 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 
>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


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.

*   For searches and help try:

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