Forum Discussion

ggp_92020's avatar
ggp_92020
Copper Contributor
Dec 02, 2025

Database Level Collation Issues

Some background information. 

In the past we had a database where we didn't really care about collation at the database, table/column, functions and views.  Though now we have a requirement due to a technology acquisition, requires SQL_Latin1_General_CP1_CI_AS.  

Microsoft seems to not have a simple method that guarantees changing the collation throughout the database on complex DBs with large amounts of tables, columns, functions, etc...  specially with high dependencies, FKs and PKs and not affect any of the data (no moving the data is not simple).

I have a command, where I stop all of the SQL services and any connections to the DB and use the following command line to change the collation to the one I specify.  The issue is this command only works about 65% of the time and no clue to the why it fails the other 35%.

The command used is:
The parameter "-s" is necessary only if you have a named instance, remove the -s if no instance.

sqlservr -m -T4022 -T3659 -s"SQL2019" -q"SQL_Latin1_General_CP1_CI_AS"

or

sqlservr -m -T4022 -T3659 -q"SQL_Latin1_General_CP1_CI_AS"

When this does not work, I have a set of 6 SQL scripts to tear the database apart in a complex method to get them operational.

Does anybody have any idea why the hit and miss on the command?
Or a better method / way to fully change the DB collation?

 

No RepliesBe the first to reply

Resources