This article has been archived. It is offered "as is" and will no longer be updated.
When you try to generate SQL script for a table by using Enterprise Manager, the primary key constraint may be generated incorrectly.
Service pack information
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
290211 How to obtain the latest SQL Server 2000 service pack
The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
Note Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files.
This issue occurs because the sp_MStablekeys system stored procedure sometimes returns logically incorrect results. Because you use sp_MStablekeys to script out a table and its constraints, you end up generating incorrect script for table constraints.
For this reason, you can experience this problem in other scenarios where this system stored procedure is used. For example, you might experience this problem with replication. Replication uses the sp_MStablekeys stored procedure to script out the tables that are marked for replication (on the publisher) to create those tables on the subscriber. When the Distribution Agent tries to create a primary key on the subscriber that is based on the generated script from the publisher, it will fail, and you receive this error message:
Cannot use empty object or column names
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section of this article.This problem was first corrected in Microsoft SQL Server 2000 Service Pack 4.