Tuesday, January 24, 2017

Problem with database collation change SQL Server



The Database could not be exclusively locked to perform the operation.
ALTER DATABASE failed. The default collation of database 'DatabaseName' cannot be set to "Collaction Name".  (Microsoft SQL Server, Error: 5030)




use master
go
ALTER DATABASE xxx SET SINGLE_USER WITH ROLLBACK IMMEDIATE
go
ALTER DATABASE xxx COLLATE yyyy
go
ALTER DATABASE xxx SET MULTI_USER
go




WARNING: this call to SET SINGLE_USER WITH ROLLBACK IMMEDIATE will disconnect anyone who might be connected to that database without warning, without chance of saving data! 

No comments:

Post a Comment