In this article, I will explain how to change the collation for your Azure SQL Managed Instance when the following scenario is encountered:
You try to change the database collation with the following T-SQL:
USE [master]
GO
ALTER DATABASE [testdb] COLLATE SQL_Latin1_General_CP1_CS_AS
GO
And it fails with the following message:
Msg 5075, Level 16, State 1, Line 24
The column 'tablex.colx' 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.
Steps in brief:
Considerations:
Steps in details:
sqlpackage.exe /Action:Export /ssn:tcp:<ServerName>.database.windows.net,1433 /sdn:<DatabaseName> /su:<UserName> /sp:<Password> /tf:<TargetFile>
For example:
<Property Name="Collation" Value="Thai_CI_AS" />
sqlpackage.exe /Action:Import /tsn:<server>.database.windows.net /tdn:<database> /tu:<user> /tp:<password> /sf:"C:\Temp\database.bacpac" /ModelFilePath:<path>model.xml
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.