1

I am running the following query in SSMS:

SET NOCOUNT ON
ALTER DATABASE [xyz] MODIFY NAME = [xyz_]

And get this:

The database name 'xyz_' has been set.
Msg 911, Level 16, State 1, Line 2
Database 'xyz' does not exist. Make sure that the name is entered correctly.

So, the query fails, but the database is still renamed!

What is going on?

4

One possibility is that there's a DDL trigger that fires for ALTER DATABASE, and that trigger code try to refer to the (now old) database name.

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.