|
Home >> FAQs/Tutorials >> SQL Server FAQ
SQL Server FAQ - Entering Unicode Character String Literals
By: FYIcenter.com
(Continued from previous topic...)
How To Enter Unicode Character String Literals?
Unicode characters are multi-byte characters. They are very hard to be entered as string literals,
because it requires:
- The SQL client tool to support Unicode characters. The command line tool 'sqlcmd' does not support Unicode.
But SQL Server Management Studio does support Unicode.
- A special Unicode character input tool to allow you to enter multi-byte Unicode characters.
But if you know the code value of a Unicode character, you can enter it with the help of the NCHAR(int)
function. For example:
-- A Unicode string of some interesting characters
PRINT NCHAR(9733)+NCHAR(9734)+NCHAR(9792)+NCHAR(9794);
GO
Run the sample statement with SQL Server Management Studio, you should see some Unicode characters.
(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?
|