Question

This first statement failed on cannot use asc

CREATE TABLE [Gabe2a_ENRONb].[dbo].[FTSindexMO] (
    [sID] [int] NOT NULL,
    [wordPos] [int] NOT NULL,
    [wordID] [int] NOT NULL,
    [charPos] [int] NOT NULL,
 CONSTRAINT [FTSindexMO] PRIMARY KEY 
    NONCLUSTERED HASH ([sID] asc, [wordPos] asc) WITH(BUCKET_COUNT = 100)
) WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_ONLY )

but when I fix the create I get an error [FTSindexMO] exists

CREATE TABLE [Gabe2a_ENRONb].[dbo].[FTSindexMO] (
    [sID] [int] NOT NULL,
    [wordPos] [int] NOT NULL,
    [wordID] [int] NOT NULL,
    [charPos] [int] NOT NULL,
 CONSTRAINT [FTSindexMO] PRIMARY KEY 
    NONCLUSTERED HASH ([sID], [wordPos]) WITH(BUCKET_COUNT = 100)
) WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_ONLY )

Msg 2714, Level 16, State 5, Line 74
There is already an object named 'FTSindexMO' in the database.
Msg 1750, Level 16, State 0, Line 74
Could not create constraint or index. See previous errors.

but I cannot drop the database

drop table [Gabe2a_ENRONb].[dbo].[FTSindexMO]

Msg 3701, Level 11, State 5, Line 72
Cannot drop the table 'Gabe2a_ENRONb.dbo.FTSindexMO', because it does not exist or you do not have permission.

That name is not in sysObjects

That table name is not displayed in SSMS (and I did refresh)

If I create another table with proper syntax then I can delete it

What is interesting is if I use proper syntax twice the error message is not same
It does not include the constraint error

I had a problem a while ago with regular table that got corrupt and I was able to delete it from View Object Explorer Detail but this table is not listed their either

Was it helpful?

Solution

In you example t-sql statements, you are trying to create a constraint with the same name as that of the table i.e 'FTSindexMO'. Hence, you are getting the error message "There is already an object named 'FTSindexMO' in the database." You cannot create a constraint with the same name as the table. This is the same behavior for disk-based tables and memory-optimized tables. You would need to use a different name for the constraint.

Thanks & Regards, Pooja Harjani, Sr. Program Manager, SQL Server, Microsoft.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top