While running an AR reconcile, this error was coming up
A get/change first operation on table 'RM_Distribution_History' (45)
[Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near 'S'.
[Microsoft][SQL Server Native Client 10.0][SQL Server]Unclosed quotation mark after the character string ') ORDER BY RMDTYPAL ASC ,DOCNUMBR ASC ,SEQNUMBR ASC '.
This was due to a customer ID set as AL'S and the ' was causing the code to error out
-- Script shows all records with an id containing the ' character
declare @ts as varchar (50)
set @ts = '%' + '''' + '%'
select * from rm30301 where custnmbr like @ts