Sunday, May 29, 2022

SQL Error 105 : Unclosed quotation mark before the character string '%.*ls'

Msg 105, Level 15, State 1, Line n
Unclosed quotation mark before the character string '%.*ls'

The error msg indicate not correctly formatted string. In SQL Server it must be enclosed with single quotation mark (' '). 

SQL Server uses the single quote to delimit strings.  If the data itself contains a single quote you must pass in two single quotes in order for sql server to process the string correctly.

SELECT 'Hello

Output:

Msg 105, Level 15, State 1, Line 1
Unclosed quotation mark after the character string 'Hello
'.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'Hello
'.

SELECT 'Hello'' World'''

Output:

Hello' World'

No comments:

Post a Comment