The best way to handle ODBC connections to databases (including SQL Server)
from within Stata, is to put a series of dbr or dbw (database read/database
write) commands in a Stat/Transfer command file. For instance:
dbr datasource myoracle
dbr user scott
dbr password tiger
dbr table employee
copy odbc temp.dta
If the file were saved as rd_ora.stc, you could run it with stcmd as:
stcmd rd_ora.stc
It is particularly handy to use the ODBC driver to prompt you for password
and other connection information and then save the "connection string" in
encrypted form for later re-use, as in:
dbr connstr <# saved.dat
which can replace everything above except the "dbr table" and copy commands.
All of this is explained in greater detail in the command processor
documentation, particularly the section, "Running Batch Jobs with ODBC".
Best,
Steve
----------------------------------------------------------------
Steven Dubnoff [email protected]
Circle Systems We make your data instantly usable.
Download Stat/Transfer from http://www.stattransfer.com
1001 Fourth Avenue, #3200 (206) 682-3783
Seattle, WA 98154 Fax (206) 328-4788