SQL Select As with Apostrophe

64 Views Asked by At

I am stuck with the following SQL line due to the apostrophe. I am using this to generate a table in Power BI that is used as the RLS link. As a result the apostrophe needs to stay in one string.

select '[email protected]' as Email, 'Adam O'Brian' as Access union all

How would I get around this?

Expecting a table as below:

Email Access
[email protected] Adam O'Brian

Ignoring the Union all, this is part of a long table query.

1

There are 1 best solutions below

1
Dodds22 On

Pleased to say I got this one sorted myself.

All it needed was a double apostrophe as below:

select '[email protected]' as Email, 'Adam O''Brian' as Access union all

Cheers