dbatools is a free PowerShell module with over 180 SQL Server administration, best practice and migration commands included.


Test-DbaDatabaseCollation

Compares Database Collations to Server Collation

Screenshots

test-dbadatabasecollation

Examples

Returns server name, database name and true/false if the collations match for all databases on sqlserver2014a

Test-DbaDatabaseCollation -SqlServer sqlserver2014a

Returns server name, database name and true/false if the collations match for the db1 and db2 databases on sqlserver2014a

Test-DbaDatabaseCollation -SqlServer sqlserver2014a -Databases db1, db2

Lots of detailed information for database and server collations for all databases except db1 on sqlserver2014a and sql2016

Test-DbaDatabaseCollation -SqlServer sqlserver2014a, sql2016 -Detailed -Exclude db1

Returns db/server collation information for every database on every server listed in the Central Management Server on sql2016

Get-SqlRegisteredServerName -SqlServer sql2016 | Test-DbaDatabaseCollation

Get-Help

From PowerShell, execute Get-Help Test-DbaDatabaseCollation -Detailed for more information on this function.

Source Code

Want to see the source code? View Test-DbaDatabaseCollation.ps1 on GitHub
 

Related commands