SQL Server escape single quote when coming from select statement
Posted on 2014-08-05
I have a Stored Procedure that inserts a new record into table A by pulling the data from Table B based upon an ID.
The address field from Table B, which needs to be inserted into Table A, may contain a Single Quotation tick mark.
Currently it causes an error. How do I deal with this?
My Code looks like this:
INSERT INTO TABLE A
SELECT address1, address2
FROM TABLE B
WHERE (id = @ID)