none
Collation guide line RRS feed

  • Question

  • Dear all,

    I have seen that collation could be defined at database level but also at table column level.

    What is the rule on setting collation at database level and column level ?

    Does table column collation override database table ?

    Does database collation should be set same as in table column ?

    regards

    Monday, September 9, 2019 6:29 AM

Answers

  • No, there's no table collation. But there *is* column level collation.

    If you specify a collation at the column level, then it will override the database collation. You only typically do this if you have special needs, like for instance case-sensitivity for a certain column.


    Tibor Karaszi, SQL Server MVP (Web Blog)

    • Marked as answer by wakefun Monday, September 9, 2019 9:53 AM
    Monday, September 9, 2019 6:51 AM

All replies

  • <<<Does table column collation override database table ?

    No, you can have a database collation  let me see call AAA and column collation BBB

    >>Does database collation should be set same as in table column ?

    Generally YES, but certainly  it may different

    https://www.red-gate.com/simple-talk/sql/sql-development/questions-sql-server-collations-shy-ask/


    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance
    SQL Server Integration Services: Business Intelligence



    Monday, September 9, 2019 6:46 AM
    Moderator
  • No, there's no table collation. But there *is* column level collation.

    If you specify a collation at the column level, then it will override the database collation. You only typically do this if you have special needs, like for instance case-sensitivity for a certain column.


    Tibor Karaszi, SQL Server MVP (Web Blog)

    • Marked as answer by wakefun Monday, September 9, 2019 9:53 AM
    Monday, September 9, 2019 6:51 AM
  • Hi Wakefun,

    I have seen that collation could be defined at database level but also at table column level.
       Yes, fact, we can have define collations at 1.server-level,2.database-level,3.table's column level and 4.expression-level but not on table level.

    What is the rule on setting collation at database level and column level ?
       No rules on setting collations. But anyhow during dabase design itself, need to design the table's collation by considering the future join condition uses. 
    Or else it would leads to collation conflicts. Then need to force/use the expression-level collation to handle collation conflicts.
       Link : https://stackoverflow.com/questions/20544392/how-to-get-rid-of-collation-conflict-in-a-sql-server-query

    Does table column collation override database table ?
       Yes, The fact is we can override the database level collation by using table's column level collation and we can also override table's column level collation
    by using expression-level collation.

    Does database collation should be set same as in table column ?
       Not compulsory. we can change based on our requirement/convenience.

    Please mark this as answer if it solved your issue. 
    Please vote this as helpful if it helps to solve your issue. 

    Thanks,
    Arulmouzhi
    Monday, September 9, 2019 7:13 PM