ACC2000: Cannot Use Upsized Append and Make-Table Queries in an Access Project (229681)
The information in this article applies to:
This article was previously published under Q229681 Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies only to a Microsoft Access project (.adp).
For a Microsoft Access 2002 version of this article, see 294923.
SYMPTOMS
When you try to run upsized make-table or append queries in a Microsoft Access project, you may receive the following error message:
Cannot run SELECT INTO in this database. The database owner must run sp_dboption to enable this option.
Cannot insert explicit value for identity column in table 'table name' when IDENTITY_INSERT is set to OFF.
You may also encounter the first error message when running an upsized update query.
CAUSE
When you create a new Microsoft Data Engine (MSDE) or SQL Server database, the select into/bulkcopy and IDENTITY_INSERT options are set to OFF.
Upsized Make-Table Queries
When you upsize a database that contains make-table queries, the queries migrate as stored procedures. These stored procedures use the SELECT INTO statement to create a new table and then add records to it. You must set the select into/bulkcopy option of the database to ON in any database that contains a stored procedure that uses the SELECT INTO statement.
Upsized Update and Append Queries
If you upsize a Microsoft Access table that contains a field of the AutoNumber data type, the field will be created on MSDE or SQL Server as an IDENTITY column. Unlike the AutoNumber data type, you cannot directly edit IDENTITY columns, nor explicitly insert data into an IDENTITY column while the IDENTITY_INSERT option for that table is set to OFF. To insert or update data in an IDENTITY column, you must set the IDENTITY_INSERT option to ON.
RESOLUTION
To set the select into/bulk copy option to ON for your database, create a stored procedure that uses the sp_dboption system stored procedure to toggle the setting. The following SQL sample modifies a database named MyDatabase so you can use SELECT INTO statements:
CREATE PROCEDURE SetMyOptions
AS
EXEC sp_dboption 'MyDatabase','bulkcopy','ON'
You can use the SET IDENTITY_INSERT statement to set the IDENTITY_INSERT option. SET IDENTITY_INSERT always references a table, and should be placed before the UPDATE or INSERT statement that modifies or inserts data into an IDENTITY column. The following example sets IDENTITY_INSERT for the NewEmployees table.
SET IDENTITY_INSERT NewEmployees ON
REFERENCES
For more information about sp_dboption and IDENTITY INSERT, refer to SQL Server Books Online. To download the SQL Server Books Online, visit the following Microsoft Web site:
Modification Type: | Minor | Last Reviewed: | 8/9/2004 |
---|
Keywords: | kbdownload KbClientServer kbprb KB229681 |
---|
|