Reputation: 105043
What special characters I should escape in T-SQL (SQL Server) string?
SET @email = ''[email protected]''
Fails.
Upvotes: 2
Views: 2103
Reputation: 38506
There should not be two single quotes in that query...
set @email = '[email protected]'
will work just fine...
You'll need to escape single quotes, which is done by putting 2 single quotes. If for example you really wanted '[email protected]'
with the quotes in the database, you would replace '
with ''
in the data, and still quote it:
set @email = '''[email protected]'''
Upvotes: 1
Reputation: 27339
If you want @email to have the value '[email protected]'
, try:
SET @email = '''[email protected]'''
Upvotes: 3
Reputation: 135729
No need for the second set of single quotes.
SET @email = '[email protected]'
Upvotes: 0