Does somebody know how to escape the following quote within the string correctly?
PDM-40-100'
The string has an quote on the right end.
Does somebody know how to escape the following quote within the string correctly?
PDM-40-100'
The string has an quote on the right end.
In SQL escaping (') can be achieved with (''). User PDM-40-100''
instead of PDM-40-100'
.
If varX= PDM-40-100' then you can use Replace(varX,"'","''")
This is a sample for 1 string. With this logic, you can escape all rows in table.
Declare @string as varchar(12)='PDM-40-100'''
Select left(@string, len(@string)-1)