title: Change Collation in SQL Server
body: <p>I tried to change collation database like this :</p>
  
  <pre><code>ALTER DATABASE [MYDB] 
  SET SINGLE_USER WITH ROLLBACK IMMEDIATE; 
  GO 
  
  ALTER DATABASE [MYDB]
  COLLATE SQL_Latin1_General_CP1_CI_AS
  GO 
  
  ALTER DATABASE [MYDB] 
  SET MULTI_USER; 
  GO 
  </code></pre>
  
  <p>But I got this error:</p>
  
  <blockquote>
    <p>Nonqualified transactions are being rolled back. Estimated rollback completion: 0%.<br>
    Nonqualified transactions are being rolled back. Estimated rollback completion: 100%.<br>
    Warning: Changing default collation for database 'MYDB', which is used in replication. All replication databases should have the same default collation.</p>
    
    <p>Msg 5075, Level 16, State 1, Line 10<br>
    The object 'CK_PriceL_EndDate' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it.<br>
    Remove the dependencies on the database collation and then retry the operation.</p>
    
    <p>Msg 5075, Level 16, State 1, Line 10<br>
    The object 'CK_PriceL_Price' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.</p>
    
    <p>Msg 5075, Level 16, State 1, Line 10<br>
    The object 'chk_trades_year' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.</p>
    
    <p>Msg 5075, Level 16, State 1, Line 10<br>
    The object 'chk_trades_month' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.</p>
    
    <p>Msg 5075, Level 16, State 1, Line 10<br>
    The object 'SplitObjects' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.</p>
    
    <p>Msg 5072, Level 16, State 1, Line 10<br>
    ALTER DATABASE failed. The default collation of database 'MYDB' cannot be set to SQL_Latin1_General_CP1_CI_AS.</p>
  </blockquote>
  
  <p>I read how to set single user to multi user in <a href="https://docs.microsoft.com/en-us/sql/relational-databases/databases/set-a-database-to-single-user-mode?redirectedfrom=MSDN&amp;view=sql-server-ver15" rel="nofollow noreferrer">doc.microsoft</a></p>
  
  <p>I read how to set or change the database collation in <a href="http://Set%20or%20Change%20the%20Database%20Collation" rel="nofollow noreferrer">doc.microsoft</a></p>
  
  <p>Note: this server is main publisher of replication, I use SQL Server 2019</p>