Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I see the views in ODBC data source?

    Hello all,

    I just got my copy of Stata. I am brand-new to Stata.

    I would like to get data from SQL views on a Microsoft SQL server. I looked at previous discussions and found that you can do it with a script.

    What I would like to do is to pull the data in with the File > Import Data > ODBC data source menu. Currently, I can connect to the ODBC source, but it only displays the tables, not the views.

    How do I get to see the views?

    Thanks,

    Deguza

  • #2
    Originally posted by Artur Deguzman View Post
    What I would like to do is to pull the data in with the File > Import Data > ODBC data source menu. Currently, I can connect to the ODBC source, but it only displays the tables, not the views.

    How do I get to see the views?
    You'll see various checkboxes in the bottom-most section of the menu.

    Before you choose your ODBC data source, check (tick) two boxes down there: "Display all table types for data source" and "Do not quote SQL table name."

    Then select your Microsoft SQL Server data source from the "ODBC data sources:" combobox up at the top of the menu.

    In the "Tables" display window on the menu, you will then see both base tables and views for what you've been authorized to see. (If your database administrator is uncareful, then you might see a lot of system tables and views, too. Don't mess with those.)

    I just got my copy of Stata. I am brand-new to Stata.

    I would like to get data from SQL views on a Microsoft SQL server. I looked at previous discussions and found that you can do it with a script.
    When you pull in your data via the menu system, Stata will generate the underlying code and display it in the Results window. I recommend studying it for future use. It shouldn't take too much time to learn how to use "script" (that is, the command line mode) in Stata for all of your data management tasks, as well as all of your other tasks.

    Comment


    • #3
      It worked! Thank you very much, Joseph.

      Deguza

      Comment

      Working...
      X