Can I use prefix unicode/ prefix N notation in Looker?

Knowledge Drop

Last tested: Jul 3, 2019
 

You can use prefix N notation in the sql parameter of a dimension or other sql_* parameter types however this could lead to issues with filtering on the dimension.

For example, if you have a dimensions with sql: N'Hello' ;; and then filter on that dimension in an explore for is equal to 'Hello', Looker will not generate N'Hello' in the WHERE clause so you will see no results in some cases, depending on the database settings.

The better thing to do in this case is to configure the SQL server with a Collation that supports the desired string literals, and then never use the N'' prefix. https://docs.microsoft.com/en-us/sql/relational-databases/collations/collation-and-unicode-support?view=sql-server-2017

This content is subject to limited support.                

Version history
Last update:
‎05-07-2021 09:49 AM
Updated by: