Using Single Quotes in SQL Queries
Did you ever searched how to use a single quote inside SQL query? In this article I explain how to do.
( 1.) To display a quote in between of two field values.
SELECT FirstName + ''' ' + LastName From tblStudent
The above will put a single quote and a space in between FirstName and LastName fields.
( 2.) To insert a record with a quote to a table.
INSERT INTO [tbl] (ColumnName) VALUES ('I'+'''m ok.')
The above will insert a record into tbl and will put the string of {I'm ok.} to the column ColumnName.
( 3.) To update a record will be possible as follows.
UPDATE [tbl] SET ColumnName='I'+'''m ok.'
The above will update ColumnName values of all the records of tbl in to {I'm ok.}.