-1

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.

2 Answers2

1

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,"'","''")

0

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) 
Marko Ivkovic
  • 1,262
  • 1
  • 11
  • 14