How to change character encoding to a column ?

  • How to change character encoding to a column ?

    when I run this :

    SELECT collation_name FROM sys.columns
    WHERE name = 'FILENAME'
    AND [object_id] = OBJECT_ID('dbo.ATTACHMENT');

    I get :  SQL_Latin1_General_CP1_CI_AS

    I want to set it to UTF-8 encoding  ....I'm planning to save some unicode string in this column.

    the column has data type nvarchar

    Question :  How do I set  UTF-8 encoding  to a column of a table in MS SQL Server 2008 ?

    Is there any script ?

  • spectra - Thursday, June 22, 2017 5:50 AM

    How to change character encoding to a column ?

    when I run this :

    SELECT collation_name FROM sys.columns
    WHERE name = 'FILENAME'
    AND [object_id] = OBJECT_ID('dbo.ATTACHMENT');

    I get :  SQL_Latin1_General_CP1_CI_AS

    I want to set it to UTF-8 encoding  ....I'm planning to save some unicode string in this column.

    the column has data type nvarchar

    Question :  How do I set  UTF-8 encoding  to a column of a table in MS SQL Server 2008 ?

    Is there any script ?

    SQL Server 2008 does not support UTF-8 but you can store the data as VARBINARY
    😎

  • Eirikur Eiriksson - Thursday, June 22, 2017 6:56 AM

    spectra - Thursday, June 22, 2017 5:50 AM

    How to change character encoding to a column ?

    when I run this :

    SELECT collation_name FROM sys.columns
    WHERE name = 'FILENAME'
    AND [object_id] = OBJECT_ID('dbo.ATTACHMENT');

    I get :  SQL_Latin1_General_CP1_CI_AS

    I want to set it to UTF-8 encoding  ....I'm planning to save some unicode string in this column.

    the column has data type nvarchar

    Question :  How do I set  UTF-8 encoding  to a column of a table in MS SQL Server 2008 ?

    Is there any script ?

    SQL Server 2008 does not support UTF-8 but you can store the data as VARBINARY
    😎

    okay .....in that case ...how  Unicode  string is saved and retrieved in SQL Server 2008 ?

  • spectra - Thursday, June 22, 2017 7:36 AM

    Eirikur Eiriksson - Thursday, June 22, 2017 6:56 AM

    spectra - Thursday, June 22, 2017 5:50 AM

    How to change character encoding to a column ?

    when I run this :

    SELECT collation_name FROM sys.columns
    WHERE name = 'FILENAME'
    AND [object_id] = OBJECT_ID('dbo.ATTACHMENT');

    I get :  SQL_Latin1_General_CP1_CI_AS

    I want to set it to UTF-8 encoding  ....I'm planning to save some unicode string in this column.

    the column has data type nvarchar

    Question :  How do I set  UTF-8 encoding  to a column of a table in MS SQL Server 2008 ?

    Is there any script ?

    SQL Server 2008 does not support UTF-8 but you can store the data as VARBINARY
    😎

    okay .....in that case ...how  Unicode  string is saved and retrieved in SQL Server 2008 ?

    SQL Server 2008 uses  UCS-2 internally which is a UTF-16 subset, use the nchar and nvarchar datatypes to store those values. This is normally not a problem unless the values needs to be in the UTF-8 binary format.
    😎

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply