DataGrip 2024.1 Help

Code Inspection: Unicode usage in SQL

Reports string literals that use national characters without the N prefix.

Without the N prefix, the string is converted to the default code page of the database. This default code page may not recognize certain characters. For more information, refer to nchar and nvarchar (Transact-SQL) at docs.microsoft.com.

Example (Microsoft SQL Server):

SELECT 'abcde' AS a; SELECT N'abcde' AS b; SELECT 'абвгд' AS c; SELECT N'абвгд' AS d;

The SELECT 'абвгд' AS c; does not have the N prefix, the 'абвгд' part will be highlighted.

Suppress an inspection in the editor

  1. Place the caret at the highlighted line and press Alt+Enter or click the Intention action icon.

  2. Click the arrow next to the inspection you want to suppress and select the necessary suppress action.

Last modified: 11 February 2024