ACC2000: Upsizing Wizard Doesn't Create Constraint for AllowZeroLength Property
ID: Q227211
|
The information in this article applies to:
Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies only to a Microsoft Access database (.mdb).
SYMPTOMS
When you upsize a table containing a field with the AllowZeroLength property set to No, the Microsoft Access 2000 Upsizing Wizard does not create a trigger or CHECK constraint in an attempt to enforce the rule.
RESOLUTION
After the Upsizing Wizard finishes, manually create a CHECK constraint or trigger to enforce the rule.
To Create a CHECK Constraint
- Complete the steps in the Steps to Reproduce Behavior section of this article to upsize the Employees table.
- Open the Access project that you created by following the instructions in the Steps to Reproduce Behavior section of this article.
- Open the Employees table in Design view.
- Right-click inside the Table Designer and click Properties.
- On the Tables tab, click New.
- In the Constraint expression box, type the following:
([LastName] <> '')
NOTE: There are no spaces between the apostrophes ('') in the sample above.
- Close the Properties dialog box, and then Save the table.
- Open the Employees table in Datasheet view.
- Change Nancy Davolio's last name to "".
- Move off the record. Note that you receive an error message.
MORE INFORMATIONSteps to Reproduce Behavior
- Open the sample database Northwind.mdb.
- Open the Employees table in Design view, and examine the properties of the LastName field. Note that the AllowZeroLength property is set to No.
- Close the Employees table.
- On the Tools menu, point to Database Utilities, and then click Upsizing Wizard.
- On the first screen of the wizard, click Create new database, then click Next.
- Specify a Server Name, Login ID, Password, and Database Name in the boxes provided. Click Next.
- In the Available Tables list, click Employees, move it to the Export to SQL Server list, and then click Next.
- Accept the default options and click Next.
- Select the Create a new Access client/server application option. In the ADP File Name box, type C:\AccessCS.adp, and then click Finish.
NOTE: You will encounter multiple errors during the upsizing process. This is expected. Click OK each time that you are prompted.
- When the upsizing process is finished, close the Upsizing Wizard Report. The Access project, AccessCS.adp, created by the wizard should start.
- In the newly created Access project, right-click the Employees table and click Triggers.
- Examine both the Employees_ITrig and Employees_UTrig triggers, and note that neither contains SQL prevent zero length strings from being used in the LastName column.
- Open Employees in Design view, right-click inside the Table Designer, and click Properties.
- On the Tables tab, note that no CHECK constraints have been created to prevent a zero length string from being used in the LastName column.
REFERENCES
For more information about constraints, see the SQL Server "SQL Server Architecture," in SQL Server Books Online.
If you want to download the SQL Server Books Online, they are available at SQL Server 7.0 Books Online
Additional query words:
pra OFF2000 allow zero length string
Keywords : kbdta
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbbug
|