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.
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.
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.
When you try to upsize to SQL Server 2000 from Access 2000 using the Upsizing Wizard you receive an "Overflow" error message.
For additional information about this issue, click the article number below
to view the article in the Microsoft Knowledge Base:
272384
(http://support.microsoft.com/kb/272384/EN-US/
)
ACC2000: "Overflow" Error Message When You Try to Upsize to SQL Server 2000
On the Tools menu, point to Database Utilities, and then click Upsizing Wizard.
Complete the steps in the Upsizing Wizard, using default selections, except where noted below:
Create New Database: Yes
Which tables do you want to export to SQL Server: Export all tables
Add timestamp fields to tables: No, never
Create a new Access client/server application: Yes
Once the upsizing tool has completed its work, close the upsizing report.
Try to run the qryMakeTable stored procedure, and note the error message.
To set the select into/bulkcopy option to ON, create a stored procedure using the following SQL:
CREATE PROCEDURE SetMyOptions
AS
EXEC sp_dboption 'NorthwindSQL','bulkcopy','ON'
Save and run the stored procedure SetMyOptions.
Run the stored procedure qryMakeTable again. Note that this time it succeeds.
Try to run the qryAppend stored procedure and note the error message.
To set IDENTITY INSERT to ON, add the following line of SQL to the qryAppend stored procedure directly after the keyword AS:
SET IDENTITY_INSERT NewEmployees ON
When complete, your stored procedure should resemble the following text:
ALTER PROCEDURE qryAppend
AS
SET IDENTITY_INSERT NewEmployees ON
INSERT INTO
NewEmployees (EmployeeID, LastName, FirstName, Title,
TitleOfCourtesy, BirthDate, HireDate, Address, City, Region,
PostalCode, Country, HomePhone, Extension, Photo, Notes,
ReportsTo)
SELECT
Employees.EmployeeID, Employees.LastName, Employees.FirstName,
Employees.Title, Employees.TitleOfCourtesy, Employees.BirthDate,
Employees.HireDate, Employees.Address, Employees.City,
Employees.Region, Employees.PostalCode, Employees.Country,
Employees.HomePhone, Employees.Extension, Employees.Photo,
Employees.Notes, Employees.ReportsTo
FROM
Employees
Save the modified stored procedure, and then run it. Note that it succeeds.
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: