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

st: WHERE SQL clause


From   Alberto Tosetto <[email protected]>
To   [email protected]
Subject   st: WHERE SQL clause
Date   Sun, 02 Feb 2003 16:08:44 +0100

Dear everybody,

  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 command

SELECT * FROM MYTABLE, WHERE AGE=20 

works otherwise fine (age is a numeric variable). I suppose the problem
is in the quotes needed to address VARCHAR values, bou I do not know how
to work around it. An obvious solution would be to include an if clause
on the odbc load command, but I was to trying to access all my already
written SQL queries without having to rewrite them as Stata commands.
Any idea?

Thank you in advance,
 

Alberto Tosetto, M.D.

Divisione di Ematologia             Department of Hematology
Ospedale S. Bortolo                 S. Bortolo Hospital
via Rodolfi                         via Rodolfi
36100 Vicenza                       36100 Vicenza
Italia                              Italy
*
*   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