在steemsql(mssql)中搜索字符中含有中文

in mssql •  7 years ago  (edited)

我想搜索一下本年发表的和中文诗有关的文章,于是我在linqpad中使用sql语句

select * from comments where created>='2018-01-01 00:00:00' and title like '%诗%'

结果是0记录,居然没有找到,这怎么回事?于是我百度谷歌,然后我换用了以下SQL语句:

select * from comments where created>='2018-01-01 00:00:00' and title like N'%诗%'

等一会儿以后,显示出162条记录。

原来要在前面加一个字符N,才能检索到中文!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!