Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Using ODBC

From   Joseph Coveney <>
To   Statalist <>
Subject   Re: st: Using ODBC
Date   Wed, 21 Feb 2007 23:55:54 +0900

David Winter wrote:

I use SQL server 2000 to store my data.  I have set up DSNs to the various
databases and pushed them to the workstations on my network.  The SQL server
security settings are different for each user and database.  I have recently
discovered the -odbc- command.  My questions are:

Are the security settings from the underlying SQL tables inherited by Stata.
For example, I have a database for reference with read-only tables. Will
Stata still allow records/variables to be added or data overwritten?

How does the -odbc load- command work? It appears to load the data as a
read-only view.

What I want to be able to do allow users to load a reference file, create
new variables and run analyses but not alter the original data in any way.


The security settings on the database and its tables would be independent
of Stata.  Stata's -odbc- will use the DSNs that you've set up for the
users.  If you're using Windows security mode, then SQL Server 2000 should
see a login reflecting the log-in that the user is running Stata under.  If
you're using SQL Server authentication, then the SQL Server will see
whatever the user types into the dialogue options (-user()-
and -password()-) in -odbc-, unless you've already set those in the DSN.

My understanding and experience is that -odbc load- essentially does a
SELECT on the table, giving the Stata user a snapshot at the time the
command is executed.  It does not create an updatable view; so, changing a
variable's contents in Stata after -odbc load- does nothing to the table in
the database.

As far as I'm aware, you can rely upon conventional RDBMS techniques (data
control language, groups and rôles, views, attending to ownership, etc.) to
prevent Stata users from altering the tables with SQL Server 2000:  as far
as SQL Server 2000 is concerned, Stata is just another analytical

Joseph Coveney

*   For searches and help try:

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