TSQL tip - Finding Apostrophes in String and Text

To find   Apostrophes ,use the following tip :

CREATE TABLE Employee (Firstname VARCHAR(10))

INSERT  INTO Employee VALUES ('SATHYA')

INSERT INTO Employee VALUES ('DEEPAK ''s')

SELECT * FROM Employee WHERE Firstname like '%''%'


--DROP TABLE Employee

SQL Server sees everything after that second single quote as an error in your SQL code.




No comments: