Collation Error

后端 未结 3 1550
长发绾君心
长发绾君心 2021-02-01 13:36

I am using Microsoft SQL Server Management Studio. I have two databases one is the system database, which has the master database and the other one is my database called C

相关标签:
3条回答
  • 2021-02-01 14:29

    Need to set it to SINGLE_USER first.

    ALTER DATABASE [database] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; 
    
    GO 
    
    ALTER DATABASE [database] COLLATE SQL_1xCompat_CP850_CI_AS; 
    
    GO 
    
    ALTER DATABASE [database] SET MULTI_USER; 
    
    GO 
    
    0 讨论(0)
  • 2021-02-01 14:31

    Work perfectly Thank you alot

    ALTER DATABASE [database] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; 
    
    GO 
    
    ALTER DATABASE [database] COLLATE SQL_1xCompat_CP850_CI_AS; 
    
    GO 
    
    ALTER DATABASE [database] SET MULTI_USER; 
    
    GO 
    
    0 讨论(0)
  • Here's the biggest hint to your problem:

    Msg 5030, Level 16, State 2, Line 1 The database could not be exclusively locked to perform the operation.

    What you need to do is set the database to single-user mode before you run the ALTER DATABASE statement, and then set it back to multi-user mode when it's completed. This will lock the database and make it available only to the current connection, which will allow you to successfully run the ALTER DATABASE ... COLLATE statement.

    You can use SQL Server Management Studio or T-SQL commands to do this.

    0 讨论(0)
提交回复
热议问题