Escape Single Quotes in SQL
Single Quotes in Select , Insert and Update SQL statement can be escaped by adding another single quote in front.
Example :
1. Select 'My baby''s name is Naman';
Note : Notice extra single quote in baby''s
2. Insert into Employee ( Id , Name ) values ( 1,'O''Connor' )
Note : Inorder to insert name O'Connor in SQL table an extra single quote was added ( O''Connor )
No comments:
Post a Comment