Help for Collation of hand written text in a query

  • Hi, I have three questions:

    In a simple query as below:

    SELECT * FROM tbl1

    WHERE varcharColumn = 'XXXXX'

    1. I know the collation of varcharColumn (Latin1_General_CI_AS), what about the string that is written by hand, does the string have a default collation? According to what collation SQL accepts it? Is it the collation of varcharColumn?

    2. What happens if I write a character by hand (in SSMS) does not belong to varcharColumn's collation? Is it converted automatically in a likeliest manner? (I tried this and see Ğ is regarded as G, is this a rule in SQL Server?)

    3. If nvarchar is used, does collation has any significance?

    Regards,

    Serter

  • If I am understanding question #1 correctly, you are asking if what is entered for a string has an impact on the collation used. No, it does not the defined collation for the column is what it is, the values do not change that.

    Unicode collation basically works the same way but it also is a bit different because it supports multiple character sets, so it will generally sort within a language but not intermix them. So if you pick a Latin1 collation all 'latin' characters will appear before a pictograph in an Asian language.

  • Hi, I want to understand what happens if the collation of a column Latin1_General (varchar), and if I write a query with a asian pictograph inside single quotes? As I experimented with Turkish, writing Türkish characters is converted automatically to its nearest latin character: g -> g, s -> s; is this a general rule?

    If two different collation columns compared, collation conflict error rises; I want to learn about written text in single quotes..

  • No, unicode does not convert to something simpler, so the pictograph for Godzilla does not move down to become the letter A.

    You can do a bit of that sort of with non-unicode types because of the underling integer value that maps to a character depending on language set but there is no guarantee the change is logical.

  • As I experimented with Turkish letters ç,s,ö,ü,g,i they are converted logically c,s,o,u,g,i (maybe because of an accent relation with latin letters), I guess this not so non latin-based alphabets..

  • It might also be alphabetical location between the two. Suffice to say SQL Server does not translate.

Viewing 6 posts - 1 through 5 (of 5 total)

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