在sql server 2008中使用unicode文本 [英] using unicode text in sql server 2008

查看:167
本文介绍了在sql server 2008中使用unicode文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网站中使用unicode文本。我在数据库中具有nvarchar(max)数据类型来存储数据。当我将unicode文本保存到数据库中时,它可以正常工作。但是,当我尝试执行一些sql操作时,unicode文本将更改为 ?????。
例如,下面的查询

I want to use unicode text in my site. I have nvarchar(max) data type in database to store the data. When I save unicode text into database, it works fine. However when i try to perform some sql operation the unicode text is changed to "?????" Eg, the query below

declare @unicodetext nvarchar(250)
set @unicodetext='बन्द'
select @unicodetext

结果

解决方案是什么这个?
谢谢

What is the solution for this? Thanks

推荐答案

尝试

declare @unicodetext nvarchar(250)
set @unicodetext = N'बन्द'
select @unicodetext

也许您注意到SQL Server在为您生成DDL脚本时对任何带引号的字符串输入使用 N

Maybe you noticed that SQL Server uses N to any quoted string input when generating DDL scripts for you.

这篇关于在sql server 2008中使用unicode文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆