|
INTERVIEW QUESTIONS
DATABASE
MS SQL SERVER
DETAILS
Question: What Happens If Strings Are Casted into Wrong Code Pages in MS SQL Server?
Answer: 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?is: e??a?o?; -- The default code page
PRINT 'Fran?is: e??a?o? COLLATE French_CI_AI; -- Code page 1252
PRINT 'Fran?is: e??a?o? COLLATE Polish_CI_AS; -- Code page 1250
PRINT 'Fran?is: e??a?o? COLLATE Cyrillic_General_CI_AS; -- Code page 1256 GO
Fran?is: e??a?o? Fran?is: e??a?o? Fran?is: e?e-aa-o? Francais: eeee-aa-oo
How find out the default Collation?
|
|
|
Category |
MS SQL Server Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 7301 users |
Added on |
9/23/2014 |
Views |
68297 |
Rate it! |
|
|
Question:
What Happens If Strings Are Casted into Wrong Code Pages in MS SQL Server?
Answer:
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?is: e??a?o?; -- The default code page
PRINT 'Fran?is: e??a?o? COLLATE French_CI_AI; -- Code page 1252
PRINT 'Fran?is: e??a?o? COLLATE Polish_CI_AS; -- Code page 1250
PRINT 'Fran?is: e??a?o? COLLATE Cyrillic_General_CI_AS; -- Code page 1256 GO
Fran?is: e??a?o? Fran?is: e??a?o? Fran?is: e?e-aa-o? Francais: eeee-aa-oo
How find out the default Collation? Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
How To Specify the Collation for a Character Data Type in MS SQL Server?
|
View Answer
|
|
What Is a Collation in MS SQL Server?
|
View Answer
|
|
How To Write Character String Constants or Literals in MS SQL Server?
|
View Answer
|
|
What Is a Constant or Literal in MS SQL Server?
|
View Answer
|
|
What Are the Differences between DECIMAL and FLOAT in MS SQL Server?
|
View Answer
|
|
What Are the Differences between CHAR and VARCHAR in MS SQL Server?
|
View Answer
|
|
What Are the Differences between CHAR and NCHAR in MS SQL Server?
|
View Answer
|
|
What Are Binary String Data Types in MS SQL Server?
|
View Answer
|
|
What Are Unicode Character String Data Types in MS SQL Server?
|
View Answer
|
|
What Are Character String Data Types in MS SQL Server?
|
View Answer
|
|
What Are Date and Time Data Types in MS SQL Server?
|
View Answer
|
|
What Are Approximate Numeric Data Types in MS SQL Server?
|
View Answer
|
|
What Are Exact Numeric Data Types in MS SQL Server?
|
View Answer
|
|
How Many Categories of Data Types Used by SQL Server?
|
View Answer
|
|
How To Create User Messages with PRINT Statements in MS SQL Server?
|
View Answer
|
|
How To Use GO Command in "sqlcmd"?
|
View Answer
|
|
What Happens to a Statement Batch If There Is a Compilation Error?
|
View Answer
|
|
What Is a Transact-SQL Statement Batch in MS SQL Server?
|
View Answer
|
|
How To Enter Comments in Transact-SQL Statements?
|
View Answer
|
|
How To Start and End Transact-SQL Statements?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All MS SQL Server Interview Questions & Answers - Exam Mode /
Learning Mode
|