Previous Topic

Next Topic

Book Contents

Book Index

Unicode support with SQL Server

Configuration

SQL Server has good support for Unicode data. No particular configuration is required on the server or client in order to use Unicode data in your database.

Data Types

Unicode strings are held in columns with the following data types: nchar, nvarchar and ntext.

Running SQL Statements with Unicode literals

In SQL Server, Unicode literals must be prefixed with an N (example: N'ald'). If the N is not included, SQL Server will interpret the literal as an ascii literal, and so will not be interpretted correctly.

To make this easy for you, AQT has an option Options > Unicode Options > For SQL Server, ensure Unicode strings are in N'xxx' format. When this is option is checked, AQT will scan all SQL being processed. If it finds any unicode values, it will ensure there is an N preceding the string.

Example:

if you run the following :

Select * from HR.TEST1 WHERE COL1 = 'ald'

AQT will actually run:

Select * from HR.TEST1 WHERE COL1 = N'ald'

This makes it very easy to use unicode data in an SQL Server database.

Advanced Query Tool
https://www.querytool.com
© 2023 Cardett Associates Ltd. All rights reserved.