Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using a name with an embedded single quote in a select statement

I want to use a query like this one below

SELECT
     Employee_Id, Work_Email, Department,City,Job_Title,Reports_To
FROM
     Employee
WHERE
   EmployeeName = 'Firstname O'Lastname'

I've tried combinations of using single and double quotes, using [] and also trying to use CHR(39) but nothing seems to get this to work properly....what do I do if the name has an embedded single quote?

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can escape the single quote with another single quote: EmployeeName = 'Firstname O''Lastname'


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

What brand of database is this query going to?

Not applicable
Author

Its a SQL server database

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can escape the single quote with another single quote: EmployeeName = 'Firstname O''Lastname'


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks...that worked.

I had thought I had tried all the possible combinations.