MS SQL Server Concepts and Programming Question:
Download Job Interview Questions and Answers PDF
How To Write Character String Constants or Literals in MS SQL Server?
Answer:
Character string literals are used everywhere in Transact-SQL statements. You need to learn some important rules on writing character string literals:
* Character string literals must be enclosed in single quotes as 'Welcome to GlobalGuideLine.com!'.
* An empty string must be expressed as ''.
* Single quote characters inside a string must be expressed as two single quotes. For example: 'It''s Sunday!'.
* Character strings use non-default character code pages must use the COLLATE clause to provide the code page through a collate name. For example, 'Fran?is' COLLATE French_CI_AS.
* Character string literals must be enclosed in single quotes as 'Welcome to GlobalGuideLine.com!'.
* An empty string must be expressed as ''.
* Single quote characters inside a string must be expressed as two single quotes. For example: 'It''s Sunday!'.
* Character strings use non-default character code pages must use the COLLATE clause to provide the code page through a collate name. For example, 'Fran?is' COLLATE French_CI_AS.
Download MS SQL Server Interview Questions And Answers
PDF
Previous Question | Next Question |
What Is a Constant or Literal in MS SQL Server? | What Is a Collation in MS SQL Server? |