Search code examples
sqlgoogle-cloud-platformgoogle-bigquerynlp

Big Query - Case Statements and Apostrophe's


Afternoon, was wondering if anyone is able to assist.

Whilst writing case statements to flag particular phrases in netezza, if we came across verbatim which contained an apostrophe I would get this round this with the below example. However im struggling to recreate this on BQ and wondered if anyone has a solution?

verbatim example : Doesn't have an account

netezza case statement example : when lower(a.case_detail) like lower('%doesn''t have an account%')

Thanks in advance for any helpful suggestions :)

currently not found a solution


Solution

  • You have at least two options:

    • escape the ' using backslash \: '%doesn\'t have an account%'
    • use double quotes to start and end the string literal: "%doesn't have an account%"