⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 odbc.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
📖 第 1 页 / 共 2 页
字号:
be generated from a SQL command is suppressed by default.  A {opt loud} option
is provided to toggle output back on.


{title:Options}

{phang}
{opt user(UserID)}
specifies that the user ID of the user attempting to establish the
connection to the data source.  By default, Stata assumes the user ID is the
same as the one specified in the previous {opt odbc} command
or is empty if {opt user()} has never been specified in the current
session of Stata.

{phang}
{opt password(Password)}
specifies the password of the user attempting to establish the
connection to the data source.  By default, Stata assumes the password is the
same as the one previously specified or is empty if the password has not been
used during the current session of Stata.
Typically, the {opt password()} option
will not be specified apart from the {opt user()} option.

{phang}
{cmd:dialog(noprompt}|{opt prompt}|{opt complete}|{cmd:required)}
specifies the mode the ODBC Driver Manager uses to display
the ODBC connection-information dialog to prompt for additional
connection information.

{pmore}
{opt noprompt} is the default value.  The ODBC connection-information
dialog is not displayed, and you are not prompted for connection
information.  If there is not enough information to establish a connection to
the specified data source, an error is returned.

{pmore}
{opt prompt} causes the ODBC connection-information dialog to be displayed.

{pmore}
{opt complete} causes the ODBC connection-information dialog to be displayed
only if there is not enough information, even if the information
is not mandatory.

{pmore}
{opt required} causes the ODBC connection-information dialog to be displayed
only if there is not enough mandatory information provided to establish a
connection to the specified data source.  You are only prompted for
mandatory information; controls for information that is not required to
connect to the specified data source are disabled.

{phang}
{cmd:dsn("}{it:DataSourceName}{cmd:")}
specifies the name of a data source, as listed by the
{opt odbc list} command.  If a name contains  spaces, it must be enclosed in
double quotes.  By default, Stata assumes that the data source name is the same
as the one specified in the previous {opt odbc} command.

{phang}
{cmd:table("}{it:TableName}{cmd:")}
specifies the name of an ODBC table stored in a specified data
source's system catalog, as listed by the {opt odbc query} command.  If a
table name contains spaces, it must be enclosed in double quotes.  Either the
{opt table()} option or the {opt exec()} option{hline 2}but not 
both{hline 2}is required with the {opt odbc load} command.

{phang}
{cmd:exec("}{it:SqlStmt}{cmd:")}
allows you to issue a SQL SELECT statement to generate a
table to be read into Stata.  An error message is returned if the SELECT
statement is an invalid SQL statement.  The statement must be enclosed in
double quotes.  Either the {opt table()} option or the {opt exec()} 
option{hline 2}but not both{hline 2}is required with the {opt odbc load}
command.

{phang}
{opt clear} permits the data to be loaded, even if there is a dataset already
in memory, and even if that dataset has changed since the data were last saved.

{phang}
{opt noquote} is a rarely used option that alters Stata's internal use of SQL
commands, specifically those relating to quoted table names, to better
accommodate various drivers.  This option has been particularly helpful for
DB2 drivers.

{phang}
{opt lowercase} causes all the variable names to be read as lowercase.

{phang}
{opt sqlshow} is a useful option for showing all SQL commands issued to the
ODBC data source from the {opt odbc insert} or {opt odbc load} command.  This 
can help you debug any issues related to inserting or loading.

{phang}
{opt allstring} causes all variables to be read in as string data types.

{phang}
{opt datestring} causes all date-formatted variables to be read in as string
data types.

{phang}
{opt create} specifies that a simple ODBC table be created on the specified data
source and populated with the data in memory.  Column data types are
approximated based on the existing format in Stata's memory.

{phang}
{opt overwrite} allows data to be cleared from an ODBC table before the data in
memory is written to the table.  All data from the ODBC table is erased, not
just from variable columns that will be replaced.

{phang}
{opt insert} appends data to an existing ODBC table and is
the default mode of operation for the {opt odbc insert} command.

{phang}
{opt quoted} is useful for ODBC data sources that require all inserted values
to be quoted.  This option specifies that all values be quoted with single
quotes as they are inserted into an ODBC table.

{phang}
{cmd:as(}{cmd:"}{it:varlist}{cmd:")} allows you to specify the ODBC variables on
the data source that correspond to the variables in Stata's memory.  If this
option is specified, the number of variables must equal the number of variables
being inserted, even if some names are identical.

{phang}
{opt loud} specifies that output be displayed for SQL commands.


{title:Examples}

{pstd}
Some of the following examples are default samples that are available when
installing Microsoft Office.  Depending on the version of Microsoft Office,
your results may vary.

    {cmd}. odbc list

    {txt}Data Source Name                   Driver
    {hline}
    Visual FoxPro Database             Microsoft Visual FoxPro Driver
    Visual FoxPro Tables               Microsoft Visual FoxPro Driver
    dBase Files - Word                 Microsoft dBase VFP Driver (*.dbf)
    FoxPro Files - Word                Microsoft FoxPro VFP Driver (*.dbf)
    MS Access Database                 Microsoft Access Driver (*.mdb)
    Excel Files                        Microsoft Excel Driver (*.xls)
    Northwind                          Microsoft Access Driver (*.mdb)
    dBASE Files                        Microsoft dBase Driver (*.dbf)
    DeluxeCD                           Microsoft Access Driver (*.mdb)
    ECDCMusic                          Microsoft Access Driver (*.mdb)
    {hline}

    {cmd}. odbc query "Northwind"

    {txt}DataSource: {result:Northwind}
    {hline}
    Categories
    Customers
    Employees
    Order Details
    Orders
    Products
    Shippers
    Suppliers
    Test
    {hline}

    {cmd}. odbc desc "Employees"

    {txt}DataSource: {result:Northwind} (query)
    Table:      {result:Employees} (load)
    {hline}
    Variable Name                               Variable Type
    {hline}
    {result:EmployeeID}                                  COUNTER
    {result:LastName}                                    VARCHAR
    {result:FirstName}                                   VARCHAR
    {result:Title}                                       VARCHAR
    {result:TitleOfCourtesy}                             VARCHAR
    {result:BirthDate}                                   DATETIME
    {result:HireDate}                                    DATETIME
    {result:Address}                                     VARCHAR
    {result:City}                                        VARCHAR
    {result:Region}                                      VARCHAR
    {result:PostalCode}                                  VARCHAR
    {result:Country}                                     VARCHAR
    {result:HomePhone}                                   VARCHAR
    {result:Extension}                                   VARCHAR
    {result:Photo}                                       LONGBINARY
    {result:Notes}                                       LONGCHAR
    {result:ReportsTo}                                   INTEGER
    {hline}

{p 4 12 2}
    {cmd}. odbc load ID=EmployeeID LastName Title in 1/5, table("Employees") dsn("Northwind")

{txt}
    {cmd}. list
{txt}
	 {c TLC}{hline 7}{c -}{hline 11}{c -}{hline 23}{c TRC}
	 {c |} {res}   ID    LastName                   Title {txt}{c |}
	 {c LT}{hline 7}{c -}{hline 11}{c -}{hline 23}{c RT}
      1. {c |} {res}    1     Davolio    Sales Representative {txt}{c |}
      2. {c |} {res}    2      Fuller   Vice President, Sales {txt}{c |}
      3. {c |} {res}    3   Leverling    Sales Representative {txt}{c |}
      4. {c |} {res}    4     Peacock    Sales Representative {txt}{c |}
      5. {c |} {res}    5    Buchanan           Sales Manager {txt}{c |}
	 {c BLC}{hline 7}{c -}{hline 11}{c -}{hline 23}{c BRC}

{p 4 12 2}
    {cmd}. odbc load, exec("SELECT EmployeeID, LastName, Title FROM Employees  WHERE EmployeeID <= 5") dsn("Northwind") clear

    {cmd}. list
{txt}
	 {c TLC}{hline 10}{c -}{hline 11}{c -}{hline 23}{c TRC}
	 {c |} {res}Employ~D    LastName                   Title {txt}{c |}
	 {c LT}{hline 10}{c -}{hline 11}{c -}{hline 23}{c RT}
      1. {c |} {res}       1     Davolio    Sales Representative {txt}{c |}
      2. {c |} {res}       2      Fuller   Vice President, Sales {txt}{c |}
      3. {c |} {res}       3   Leverling    Sales Representative {txt}{c |}
      4. {c |} {res}       4     Peacock    Sales Representative {txt}{c |}
      5. {c |} {res}       5    Buchanan           Sales Manager {txt}{c |}
	 {c BLC}{hline 10}{c -}{hline 11}{c -}{hline 23}{c BRC}
{txt}

{title:Also see}

{psee}
Manual:  {bf:[D] odbc}

{psee}
Online:  {helpb net};
{helpb fdasave},
{helpb haver},
{helpb infix},
{helpb insheet}
{p_end}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -