i have to change collation of a database from latin to spanish.

rajesh yadav 191 Reputation points
2022-09-14T05:00:11.937+00:00

hi,

1) for spanish we have selected Modern_Spanish_100_ ( i think it is correct)?

kindly suggest
yours sincerley

SQL Server | Other
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. Olaf Helper 47,441 Reputation points
    2022-09-14T05:16:05.677+00:00

    Hello,

    the collation on database level is only a default one for new objects. The effective collation is defined on column level.
    One way is to alter to collation for each column, which will fail, if there is an index on the column; you would have to re-create indexes as well.
    Other way is to create a new database will all table/objects with the right collation for char columns and copy over data.

    No matter which way you go, it will be a lot of work for you.

    1 person found this answer helpful.

  2. Erland Sommarskog 121.8K Reputation points MVP Volunteer Moderator
    2022-09-14T14:29:10.177+00:00

    You can change the collation with

       ALTER TABLE tbl ALTER COLUMN col datatype(len) COLLATE Modern_Spanish_100_CI_AS [NOT] NULL  
    

    As my template shows, you need to include the exact data type for the column. Also, the command will fail if there is an index on the column, or it is referred to with by a CHECK or FOREIGN KEY constraint.

    Or in another words, the change you are looking at is quite painful and not fun at all.

    It may be better to create a script for the database, and then do a find/replace of the collation, and then copy over data, table by table. (And hope that constraints don't break, which can happen.)

    2) for spanish we have selected Modern_Spanish_100_ ( i think it is correct)?

    You will need to ask whoever is in charge about that. We cannot say what is right or wrong for a system we know nothing about.

    1 person found this answer helpful.

  3. PandaPan-MSFT 1,931 Reputation points
    2022-09-14T07:07:39.297+00:00

    Hi @rajesh yadav ,
    According to this official article (https://learn.microsoft.com/en-us/sql/relational-databases/collations/set-or-change-the-database-collation?view=sql-server-ver16), the old version column won't be changed for your changing language action. And I think that varchar(100) is only connected with your inner storage. So I will recommed recreating.
    Best regards
    Jong


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

    0 comments No comments

  4. PandaPan-MSFT 1,931 Reputation points
    2022-09-16T06:10:58.553+00:00

    Hi @rajesh yadav ,

    Yes.I'm agree with you that "Modern_Spanish_100_" is right. Here is the reference link: https://www.red-gate.com/simple-talk/databases/sql-server/t-sql-programming-sql-server/questions-sql-server-collations-shy-ask/


  5. rajesh yadav 191 Reputation points
    2022-09-28T04:29:11.773+00:00

    thank u,
    on more concern i have used utf8 ,becuase i wanted to use Unicode(multilingual) so i have used Modern_Spanish_100_CI_AS_SC_UTF8
    in this I have used SC also I think this combination will have all Unicode range? as my target is to have full range of Unicode in spanish language.

    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.