Unicode-Compliant SQL Queries

If you specify a SQL query that contains Unicode data, keep in mind the following:

Unicode example

If, for example, you have the following value in a user variable:

MyVar = "现金"

Note: Double-quotes around the value are required.

You can use the variable in a SQL query, as follows:

select * from BANK_ACCOUNT where AccountType = :MyVar

Insight searches the value of MyVar, find that it contains at least one Unicode character, and produce the following query:

select * from BANK_ACCOUNT where AccountType = N'现金''

Note that Insight wraps the string in single quotation marks (which are required syntax in a SQL query), then adds the leading N before the first single quote. Be sure that you do not put the "N" inside the user variable value.

For detailed information about using Unicode data in SQL queries, see the Microsoft SQL Server article: Using Unicode Data (SQL Server)

Note: For adapters that do not support SQL syntax queries, you may be able to create a Insight Custom Query.

See also

Configuring the Source

Creating a SQL Query

Managing User Variables

Working with Unicode Data