Unclosed quotation mark after the character string (Msg 105)

The following error “Unclosed quotation mark after the character string…” occurs when you miss a quotation mark.

When the single quote is used once, and to close the statement SQL Server is expecting another single quote. For some reason, a user can forget to do it. For example:

BACKUP DATABASE Adventureworks TO DISK = 'diff.bak

In this case, SQL Server will send the following error message:

Msg 105, Level 15, State 1, Line 1
Unclosed quotation mark after the character string 'diff.bak'.  

Also, assume that the statement has been copied from an MS Word document or website to SSMS and the “Unclosed quotation mark after the character string…” error appears. This happened because a single quote in MS Word or website ( ‘ ) is different from a single quote in SSMS ( ‘ ).

To fix this error just put another single quote at the beginning or at the end of the statement where it is needed:

BACKUP DATABASE Adventureworks TO DISK = 'diff.bak'