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

st: Re: stat transfer


From   Steven Dubnoff <[email protected]>
To   [email protected]
Subject   st: Re: stat transfer
Date   Sat, 05 Oct 2002 11:59:28 -0700

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


*
* 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