简体   繁体   English

字符串在SQL中具有特殊字符

[英]String have special characters in SQL

I want following string to store in variable but It's giving error in SQL Server. 我想将以下字符串存储在变量中,但在SQL Server中给出错误。

DECLARE @string nvarchar(max)

set @string=''˗ˏˋmichaelˎˊ˗''

The ' is a string delimiter in t-sql. '是t-sql中的字符串定界符。 If you want to include that character in your string you need to double them. 如果要在字符串中包含该字符,则需要将其加倍。 You also need to specify that your string literal is nvarchar by preceding the string with N. 您还需要通过在字符串前面加上N来指定您的字符串文字为nvarchar。

DECLARE @string nvarchar(max)

set @string= N'''˗ˏˋmichaelˎˊ˗'''

select @string

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM