|
Home >> FAQs/Tutorials >> SQL Server FAQ
SQL Server FAQ - Casting Strings to Wrong Code Pages
By: FYIcenter.com
(Continued from previous topic...)
What Happens If Strings Are Casted into Wrong Code Pages?
In SQL Server, different collations may use different code pages. For example:
- Albanian_CI_AI_KS_WS - Albanian, Code page 1250.
- Arabic_CI_AS_KS_WS - Arabic, Code page 1256.
- French_CI_AI - French, Code page 1252.
- Korean_Wansung_BIN - Korean-Wansung, Code page 949.
- SQL_Latin1_General_CP1250_CI_AS - Latin1-General, Code page 1250.
If you are casting a string of characters from one code page to a different code page,
some character will be converted to similar. For example
PRINT 'Français: eéèê-aà-oô';
-- The default code page
PRINT 'Français: eéèê-aà-oô'
COLLATE French_CI_AI; -- Code page 1252
PRINT 'Français: eéèê-aà-oô'
COLLATE Polish_CI_AS; -- Code page 1250
PRINT 'Français: eéèê-aà-oô'
COLLATE Cyrillic_General_CI_AS; -- Code page 1256
GO
Français: eéèê-aà-oô
Français: eéèê-aà-oô
Français: eéee-aa-oô
Francais: eeee-aa-oo
How find out the default Collation?
(Continued on next topic...)
- What Is a Constant or Literal?
- How To Write Character String Constants or Literals?
- What Is a Collation?
- How To Specify the Collation for a Character Data Type?
- What Happens If Strings Are Casted into Wrong Code Pages?
- How To Find Out What Is the Default Collation in a Database?
- How Fixed Length Strings Are Truncated and Padded?
- How To Enter Unicode Character String Literals?
- How To Enter Binary String Literals?
- How To Enter Date and Time Literals?
- Why I Can Not Enter 0.001 Second in Date and Time Literals?
- What Happens If Date-Only Values Are Provided as Date and Time Literals?
- What Happens If Time-Only Values Are Provided as Date and Time Literals?
- What Are Out-of-Range Errors with Date and Time Literals?
- What Happens If an Integer Is Too Big for INT Date Type?
- How Extra Digits Are Handled with NUMERIC Data Type Literals?
- How REAL and FLOAT Literal Values Are Rounded?
- What Are the Underflow and Overflow Behaviors on FLOAT Literals?
|