Usage Note 18483: An error occurs when you use the SQL procedure to insert data into a
Microsoft Access table
An error occurs when you use the SQL procedure (PROC SQL) to insert data
into a Microsoft Access table. The error occurs when you use a LIBNAME
statement to assign a libref to a Microsoft Access database file and
then use PROC SQL to insert data from a SAS data set into an existing
Microsoft Access table. For example, suppose you submit the following
code:
libname LEDB access 'C:\my_database.mdb';
proc sql;
insert into LEDB.tblAccount
select * from tblAccount;
quit;
NOTE: Be sure to specify the name of your MDB file in the LIBNAME
statement.
The fields in the Microsoft Access table match the variables in the SAS
data set, but an error occurs, and you receive the following output:
libname LEDB access 'C:\\Mydatabase.mdb';
NOTE: Libref LEDB was successfully assigned as follows:
Engine: ACCESS
Physical Name: C:\Mydatabase.mdb
proc sql;
insert into LEDB.tblAccount
select * from tblAccount;
ERROR: Execute: Unable to insert row
ERROR: ROLLBACK issued due to errors for data set
LEDB.tblAccount.DATA.
quit;
To avoid this error, first check to see if a primary key is defined for
the Microsoft Access table. If a primary key is defined, you must remove
if from the table prior to inserting the data with PROC SQL. You can add
the primary key back to the table after the data insertion.
Operating System and Release Information
| SAS System | SAS/ACCESS Interface to PC Files | Microsoft Windows NT Workstation | 9.1 TS1M3 | |
| Microsoft Windows 2000 Server | 9.1 TS1M3 | |
| Microsoft Windows XP Professional | 9.1 TS1M3 | |
| Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 | |
| Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 | |
| Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 | |
| Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 | |
| Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 | |
| Microsoft Windows 2000 Professional | 9.1 TS1M3 | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
| Type: | Usage Note |
| Priority: | low |
| Date Modified: | 2006-09-11 12:10:04 |
| Date Created: | 2006-09-11 12:10:04 |