Can't we SET COLLATE to coulmn_name without change the settings in Database?

Ramana Kopparapu 306 Reputation points
2023-12-19T06:06:53.8366667+00:00

Hi,

I have person table having id, Fname, Lname columns. I want to change the settings from existing SQL_Latin1_General_CP1_CI_AS to Latin1_General_100_CI_AI_SC_UTF8

for FName and Lname columns in the table.

Can we change at column level? Do we need to change at Database Level?

Please assist me.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,492 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. LiHongMSFT-4306 31,311 Reputation points
    2023-12-19T06:56:34.45+00:00

    Hi @Ramana Kopparapu

    Can we change at column level?

    Yes, you can.

    See this sample:

    ALTER TABLE dbo.MyTable 
    ALTER COLUMN CharCol VARCHAR(50) COLLATE Latin1_General_100_CI_AI_SC_UTF8
    

    Refer to this doc for more details: Set or Change the Column Collation

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Olaf Helper 46,301 Reputation points
    2023-12-19T07:00:46.9666667+00:00

    Do we need to change at Database Level?

    The collation on database level is mainly a default setting, you you don't define explicit a collation when you create a table/add column.

    The effective collation is always defined on column level.

    So yes, you can change the collation per column without changing database default collation.

    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.