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.

1 Answer 1

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.

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.