Home All Groups Group Topic Archive Search About

deleted table, but somehow it's still there?

Author
12 Aug 2006 6:15 PM
vtxr1300
I had a table called ClientJob.  I wanted to change the name to Job.  I
right clicked it and selected rename and renamed it to Job.  I then
tried to create a diagram using that table and a few others, but when I
clicked save I got an error saying that the ClientJob table (not on the
diagram would be saved).  I clicked yes and then got another error
saying...

'ClientJob' table
- Unable to create index 'PK_ClientJob'.
There is already an object named 'PK_ClientJob' in the database.
Could not create constraint.

I finally just tried deleting and recreating the table.  I went through
the same steps to create the diagram but still I get the same errors.
When I try deleted the table and recreated it, I tried to give it the
name Job but got an error message that there was already a table named
Job.  So I tried ClientJob but got the same error message about a table
named ClientJob.  I tried doing a drop Table Job and drop Table
ClientJob but I got another error message saying the tables don't
exist.  How can they exist and not exist at the same time?  What can I
do to make sure the Job and ClientJob tables are deleted?  Thanks.

Author
12 Aug 2006 8:12 PM
ML
Stop using Enterprise Manager for DDL/DML. Have you tried restarting EM?


ML

---
http://milambda.blogspot.com/
Author
12 Aug 2006 10:50 PM
Erland Sommarskog
vtxr1300 (cakewal***@hotmail.com) writes:
> I had a table called ClientJob.  I wanted to change the name to Job.  I
> right clicked it and selected rename and renamed it to Job.  I then
> tried to create a diagram using that table and a few others, but when I
> clicked save I got an error saying that the ClientJob table (not on the
> diagram would be saved).  I clicked yes and then got another error
> saying...
>
> 'ClientJob' table
> - Unable to create index 'PK_ClientJob'.
> There is already an object named 'PK_ClientJob' in the database.
> Could not create constraint.

That was probably because when you renamed the table, the primary-key
constraint was not renamed.

The rest of the mess I don't really know how to explain, but if you
rename things outside diagrams, the diagrams will have the old name.

Overall, keep in mind that the tools are just tools, and not SQL Server.
You can always find the real state of things by running queries on
sysobjects or sys.objects (the latter on SQL 2005). Also keep mind
that there may be multiple tables with the same name in a database,
to wit if they are in different schemas. (On SQL 2000 owner is the
same thing as schema.)



--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

AddThis Social Bookmark Button