Get-sqmSupportedCollations
SQL ConfigurationsqmSQLTool v1.9.117+ · Get🔓 CONNECT (public)
sys.fn_helpcollations() on the target instance and returns the collation names, optionally filtered by a wildcard pattern. The set of valid collations depends on the SQL Server version and edition, so this is deliberately asked of the instance rather than hard-coded: a static list would go stale, offer collations the target does not actually support, and miss newer ones. Mainly used to discover or validate a value for -NewCollation of Invoke-sqmCollationChange, and to feed the collation picker in Show-sqmToolGui.Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string | Optional | $env:COMPUTERNAME | Target SQL Server instance. |
| -SqlCredential | PSCredential | Optional | , | SQL or Windows credential. Without it: Windows authentication. |
| -Filter | string | Optional | * | Wildcard pattern to restrict the result, e.g. 'Latin1_General*' or '*_CI_AS'. |
| -EnableException | switch | Switch | $false | Throw exceptions immediately instead of returning as errors. |
Execution Flow
Examples
All collations the instance supports
Get-sqmSupportedCollations -SqlInstance "SQL01"
Only the German collations
Get-sqmSupportedCollations -SqlInstance "SQL01" -Filter "German*"
Validate a target collation before a collation change
$target = "Latin1_General_CI_AS"
if (Get-sqmSupportedCollations -SqlInstance "SQL01" -Filter $target) {
Invoke-sqmCollationChange -SqlInstance "SQL01" -Database "AdventureWorks" -NewCollation $target -WhatIf
}