SQL Server 2012: Msg 11730, Database name cannot be specified for the sequence object in default constraints

In this post, I am providing solution to use a single Sequence object between different databases.

Generally, we are creating a sequence constraint to assign a sequence object to a particular table, but here table and sequence both are on the same database.

Sometimes, we also require to use a Sequence object of an another database.
Unfortunately, you cannot specify another database name when you are creating a default sequence constraint.

Below is a full demonstration on this error and solution.

First, create one Sequence object:

I have created this sequence into AdventureWorks2012 database.

Now use this created Sequence object into TempDB:

You will get this error message:

SQL Server Sequence Database Name Error

The solution is to use Sequence object with INSERT statement:

The Result:

SQL Server Sequence Database Error Result

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from dbrnd.com

Leave a Reply

Be the First to Comment!

Notify of