0

Can we have a sequence and table with the same name? I am trying to create a sequence with the same name as an existing table, but I get this error:

There is already an object named 'XYZ' in the database.

I haven't found any documentation about this.

3

An attempt to document this is made here:

CREATE SEQUENCE (Transact-SQL)

sequence_name
Specifies the unique name by which the sequence is known in the database.

It is not very clear that the name must be unique across all objects in the database. And even that is not true. The name must be unique within the schema in a database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.