Reputation: 10236
in SQL Server we denote unicode string literals thus:
declare @s nvarchar(max)
select @s = N'test'
however, we can also use double quotes... so we should be able to do this:
set quoted_identifier off
declare @s nvarchar(max)
select @s = N"test"
but there I've gone wrong:
Msg 102, Level 15, State 1, Line 2 Incorrect syntax near 'test'.
what is the correct form?
Upvotes: 1
Views: 3145
Reputation: 37225
In T-SQL, you can use the double-quote to specify the name of a column in a SELECT statement, in the same way use can use square brackets [].
Compare
select 1 as "value x"
select 1 as [value x]
both resulting in a column named value x
.
For string literals, only ''
and N''
can be used.
Update after comment from Nikola
The MSDN page on T-SQL constants mentions the QUOTED_IDENTIFIER/double-quote/single-quote behavior only for "character string constants", but the section "Unicode strings" only refers to the N''
notation.
Upvotes: 0
Reputation: 3771
You can't use double-quotes to delimit Unicode character strings in T-SQL.
So what? What's the problem you're trying to solve?
You can still embed single-quotes within a Unicode string by doubling them up.
SELECT N'This isn''t a problem'
Upvotes: 0