One of the most frustrating thing that happended to me recently was looking for an unenclosed quotation mark after a character. The error message “Unclosed quotation mark after the character string” appeared when a client ran a Historical Aged Trial Balance for Payables Management in Microsoft Dynamics GP. Microsoft offered a solution here. My initial thought that I would be able to find the problem voucher with little effort. It should have been a simple select statement filtered to look for a wildcard and single quotation. I was wrong.
I found that T-SQL likes the single quotes as much as my cat likes water. I still have scratches from the last bath (not pretty). Here is a screenshot of my first attempt.
The syntax wasn’t compatible with my theory. After about an hour of attempting different solutions, I found that you had to search for wildcards before and after the quotations. Here is the SQL solution.
Select * from PM30200 where Doctype=’6′ and VCHRNMBR like ‘%”%’