November 13, 2007 at 2:06 am
Hello
I tried to add table with the following statement:
CREATE TABLE MANAGER (FIRST_NAME nvarchar (50) ,ID int ,LAB_ID int ,LAST_NAME nvarchar (50) ,RESPONSIBILTY nvarchar (50) CONSTRAINT PK_MANAGER PRIMARY KEY (ID ) CONSTRAINT MANAGER FOREIGN KEY ( LAB_ID ) REFERENCES LAB ( ID ) ON DELETE CASCADE ON UPDATE CASCADE )
and I gets the following error :
Msg 2714, Level 16, State 4, Line 1
There is already an object named 'MANAGER' in the database.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
:w00t:
in spite of the fact that I can't see any such table in the database :crazy:
Thanks
Rachamim
November 13, 2007 at 2:08 am
The error says
"There is already an object named 'MANAGER' in the database."
So the object doesn't have to be a table. I suggest look in sys.objects
for any objects with the name manager.
[font="Verdana"]Markus Bohse[/font]
November 13, 2007 at 2:18 am
Is there any easy way to check it , there is a lot of object here
November 13, 2007 at 2:39 am
Hi,
Here's an example query
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.tables
Where table_name = Manager
Thank you,
Phillip
November 13, 2007 at 2:57 am
well, its not there, and I think that 'MANAGER' isn't a table
is there any other place I can look for?
November 13, 2007 at 2:59 am
Hi,
Run this in context of the database in question:
select * from sysobjects
where name like '%manager'
and type = 'U'
Thank you,
Phillip Cox
November 13, 2007 at 3:29 am
I do so Philip but I got empty table as result
Rachamim
November 13, 2007 at 4:18 am
Change the foreign key constraint name from MANAGER to FK_MANAGER.
November 13, 2007 at 4:30 am
Thank you very much Suresh B. its work:)
indeed it was stupid mistake
Rachamim
November 13, 2007 at 4:46 am
Welcome.
Mistakes happen sometimes.
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply