Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 collation

Author  Topic 

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2006-09-05 : 02:10:20
dear experts
while i'm learning BCP from books online, i got a doubt.
copying data between different collations.
what exactly the meaning of collation?


i tried in BOL. but because i'm a junior, i didnt got the good idea about collation.
please explain me


thankyou friends

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-05 : 03:18:50
Collation is the set of characters used to represent your or any other's alphabet.

We in Sweden most often use the FINNISH_SWEDISH collation to be able to view our special characters, such as {å, ä, ö} and {Å, Ä, Ö}. We have 28 29 letters in our alphabet, where the english and americans has only 25 26 letters {a-z}. We have {a-z} plus {å}, {ä}, and {ö}.

Spanish speaking countries has their special characters such as {ñ}.
Other countries has other special symbols such as {Þ} (iceland) and {ü} (germany).

Does this answer your question?


Peter Larsson
Helsingborg, Sweden

EDIT: Calculated the letters wrongly.
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2006-09-05 : 03:48:27
A collation controls the result that you gets when you compares two character strings.
As Peter said, in the Swedish writing system, three of the vowels are represented by the characters å, ä and ö. But these characters are considered as distinct letters -- they aren't just a letter with an accent -- and as letters, they sort after z. Other languages would order them differently: for example, in Hungarian, ö comes between o and p.

Collation can also control whether upper- and lower-case * characters are considered the same or different (_CI or _CS), whether to ignore accents on characters(_AI or _AS), or whether to ignore the problem completely and just use the codepoints of the characters to order strings (_BIN, _BIN2).
For Unicode character strings (nchar, nvarchar, ntext), the character set is always the Unicode Character Set. For other string types (char, varchar, text), the collation determines the character set that's used.

* and title-case if you're writing Croatian!

(Sorry, Peter, if this is a bit presumptuous, given that I don't know any Swedish. But you didn't say anything about ordering, which is one of the main points of collation in SQL Server.)
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2006-09-05 : 03:52:47
BTW, Peter, v and w are different in English, so it's 26, not 25.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-05 : 04:01:03
That's ok. You've done an excellent explanation.

They are different in Swedish too. We have 29 letters.
I figured that out now. I only calculated ASCII 90 - ASCII 65 (25). I forgot to add 1 since 65 actually is a letter...


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2006-09-05 : 04:08:11
>They are different in Swedish too.

According to http://en.wikipedia.org/wiki/Swedish_alphabet that's a rather recent change (officially, at least). So this returns 'equal':

SELECT CASE WHEN 'v' COLLATE Finnish_Swedish_CI_AI = 'w' THEN 'equal' ELSE 'different' END

(With _AS, they're different, but only at the accent level)
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-05 : 04:14:25
Is that true in both 2000 and 2005?
Do we have to wait for next service pack to fix this


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2006-09-05 : 04:17:00
thank you very much friends.now i got some Idea.
Go to Top of Page
   

- Advertisement -