SAS/ACCESS Interface to ODBC |
Overview |
See DBLOAD Procedure for general information on this feature. ODBC examples are available.
SAS/ACCESS Interface to ODBC supports all DBLOAD procedure statements (except ACCDESC=) in batch mode. Here are the DBLOAD procedure specifics for ODBC:
Here are the database description statements that PROC DBLOAD uses:
specifies the name of the data source in which you want to store the new ODBC table. The data-source is limited to eight characters.
The data source that you specify must already exist. If the data source name contains the _, $, @, or # special character, you must enclose it in quotation marks. The ODBC standard recommends against using special characters in data source names, however.
lets you connect to an ODBC database with a user ID that is different from the default ID. USER= is optional in ODBC. If you specify USER=, you must also specify PASSWORD=. If USER= is omitted, your default user ID is used.
specifies the ODBC password that is associated with your user ID.
PASSWORD= is optional in ODBC because users have default user IDs. If you specify USER=, you must specify PASSWORD=.
Note: If you do not wish to enter your ODBC password in uncoded text on this statement, see PROC PWENCODE in Base SAS Procedures Guidefor a method to encode it.
determines whether SAS uses the Microsoft Bulk Copy facility to insert data into a DBMS table (Microsoft SQL Server only). The default value is NO.
The Microsoft Bulk Copy (BCP) facility lets you efficiently insert rows of data into a DBMS table as a unit. As the ODBC interface sends each row of data to BCP, the data is written to an input buffer. When you have inserted all rows or the buffer reaches a certain size (the DBCOMMIT= data set option determines this), all rows are inserted as a unit into the table, and the data is committed to the table.
You can also set the DBCOMMIT=n option to commit rows after every n insertions.
If an error occurs, a message is written to the SAS log, and any rows that have been inserted in the table before the error are rolled back.
Note: BULKCOPY= is not supported on UNIX.
enables you to specify whether the columns that are associated with the listed SAS variables allow NULL values. By default, all columns accept NULL values.
The NULLS statement accepts any one of these three values:
Y - specifies that the column accepts NULL values. This is the default. | |
D - specifies that the column is defined as NOT NULL WITH DEFAULT. |
Examples |
The following example creates a new ODBC table, TESTUSER.EXCHANGE, from the DLIB.RATEOFEX data file. You must be granted the appropriate privileges in order to create new ODBC tables or views.
proc dbload dbms=odbc data=dlib.rateofex; dsn=sample; user='testuser'; password='testpass'; table=exchange; rename fgnindol=fgnindollars 4=dollarsinfgn; nulls updated=n fgnindollars=n dollarsinfgn=n country=n; load; run;
The following example only sends an ODBC SQL GRANT statement to the SAMPLE database and does not create a new table. Therefore, the TABLE= and LOAD statements are omitted.
proc dbload dbms=odbc; user='testuser'; password='testpass'; dsn=sample; sql grant select on testuser.exchange to dbitest; run;
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.