Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"The Collation specified by SQL Server is not supported." for Georgian_Modern_Sort_CI_AS collation #2182

Closed
cleng-ms opened this issue Oct 13, 2023 · 1 comment · Fixed by #2194

Comments

@cleng-ms
Copy link

Describe the bug

When a database's collation is set to Georgian_Modern_Sort_CI_AS collation, and it has a table that contains a varchar() column, then querying that table in SSMS fails with the following error.
Msg 0, Level 11, State 0, Line 0
The Collation specified by SQL Server is not supported.

This problem can be reproduced on SSMS 19 and SSMS 18 with SQL2019 and SQL2017. It is a 100% repro.

Exception message:
Msg 0, Level 11, State 0, Line 0
The Collation specified by SQL Server is not supported.

To reproduce

With SSMS 19.1

  1. Right click on Database, and then click "New Database..."
  2. In the "New Database" window, set Database name to Coltest1.
    Select the Options page, and change Collation from Default to Georgian_Modern_Sort_CI_AS
    Click OK to create the database.
  3. Right click on the newly created database "Coltest1", and then "New Query".
  4. Copy the following query text and paste into the query window.

create table t (v varchar(20))
go
insert t
values ('abcd')
go
select * from t

  1. execute the query.
    You should see the following error.
    Msg 0, Level 11, State 0, Line 5
    The Collation specified by SQL Server is not supported.

But this does not seem to be an issue specific to SSMS. You can repro with pretty much any .Net application.

 using System;
using System.Data.SqlClient;
 
class C
{
    static void Main()
    {
        // Pick your server here...
        var connStr = new SqlConnectionStringBuilder()
        {
            DataSource = "VLM00230243",
            IntegratedSecurity = true,
            Pooling = false
        };
 
        // Make up a new DB name...
        var db = Guid.NewGuid().ToString();
 
        var sqlconn = new SqlConnection(connStr.ConnectionString);
        sqlconn.Open();
 
        // Create DB with interesting collation... (it's key for the repro)
        var sqlcmd = new SqlCommand($"CREATE DATABASE [{db}] COLLATE Georgian_Modern_Sort_CI_AS", sqlconn);
        sqlcmd.ExecuteScalar();
        sqlconn.Close();
 
        connStr.InitialCatalog = db;
 
        sqlconn = new SqlConnection(connStr.ConnectionString);
        sqlconn.Open();
 
        // Create table (using VARCHAR is also critical for the repro; NVARCHAR works just fine)
        sqlcmd = new SqlCommand("CREATE TABLE T1(C1 varchar(16) NOT NULL)", sqlconn);
        sqlcmd.ExecuteScalar();
        sqlcmd = new SqlCommand("INSERT T1 values('abcd')", sqlconn);
        sqlcmd.ExecuteScalar();
        sqlconn.Close();
 
        sqlconn = new SqlConnection(connStr.ConnectionString);
        sqlconn.Open();
        sqlcmd = new SqlCommand("SELECT * FROM T1", sqlconn);
 
        // If you get an exception at the next line, you've got a repro
        var o = sqlcmd.ExecuteScalar();
        Console.WriteLine(o);
    }
}

Expected behavior

The query succeeds.

Further technical details

Microsoft.Data.SqlClient version: 3.1.3
.NET target: Framework 4.8.04161
SQL Server version: SQL Server 2019
Operating system: Windows Server 2022

Additional context
Add any other context about the problem here.

@JRahnama JRahnama added this to Needs triage in SqlClient Triage Board via automation Oct 18, 2023
@JRahnama
Copy link
Member

@cleng-ms we will look into this and will get back to you soon.

@JRahnama JRahnama moved this from Needs triage to Needs Investigation in SqlClient Triage Board Oct 19, 2023
SqlClient Triage Board automation moved this from Needs Investigation to Closed Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants