Encoding for non latin character giving question mark (?????) in Azure SQL

Vee 0 Reputation points
2023-08-15T11:15:34.9166667+00:00

Hi All,

I am ingesting data to Azure SQL. For those record non-latin character giving a question mark (?????) in the database. It's like Chinese, Japanese and Rusia character.

Is there anyway that we can get the original character instead of question mark (?????)? Is this related to collation setting?

Thank you and appreciate your help.

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Sedat SALMAN 14,180 Reputation points MVP
    2023-08-15T11:22:29.7033333+00:00

    Make sure that the columns that will contain non-Latin characters are of the data type NVARCHAR, NCHAR, or NTEXT. While inserting data with non-Latin characters using a SQL query, make sure to prefix string literals with a N to denote that it's a Unicode string.

    INSERT INTO YourTable (ColumnName) VALUES (N'............');
    

    You can consider setting the collation of your database or column to a Unicode-aware one,

    To check the collation of your database:

    SELECT DATABASEPROPERTYEX('YourDatabaseName', 'Collation') AS Collation;

    SELECT DATABASEPROPERTYEX('YourDatabaseName', 'Collation') AS Collation;
    

    Or to set a specific collation for a column:

    ALTER TABLE YourTable
    ALTER COLUMN YourColumn NVARCHAR(255) COLLATE Latin1_General_100_CI_AS_SC_UTF8;
    
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.