sql server中的arabic变量 [英] arabic variable in sql server

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

问题描述

嗨所有

i已存储其参数中的哪一个是阿拉伯语,我在输入此参数时遇到问题,如下所示

  @ Grade   nvarchar  50 
as

begin
声明 @ s nvarchar 50
set @s = N '+ @ Grade +'
print @ s





结果是'@Grade',那我怎么能以正确的格式输入呢

解决方案

据我所知,您希望将阿拉伯语值保存在变量中。

为此尝试:

1.您可以使用阿拉伯语排序

 创建  #testArabic 

column1 nVARCHAR 100 COLLATE Arabic_CI_AI_KS_WS



$ / b $



对于能够存储unicode字符的字段,您必须使用nvarchar或ntextor nchar类型。

要在数据库中插入unicode字符,必须使用编码方面的参数类型(如nvarchar / SqlDbType.NVarChar)将文本作为unicode发送。


尝试:

  @ Grade   nvarchar  50 
as

开始
声明 @ s nvarchar 50
set @ s = N ' + @ Grade
print @ s





如需了解更多信息,请参阅:

整理和Unicode支持 [ ^ ]

设置或更改数据库归类 [ ^ ]

COLLATE( Transact-SQL) [ ^


hi all
i have stored which one of its parameter is in Arabic, i have a problem in entering this parameter like below

@Grade nvarchar(50)
as

begin
declare @s  nvarchar(50) 
set @s= N "'+@Grade+'" 
print @s



the result is '@Grade', So how could i input it in the correct format

解决方案

As per i understand from your question you want to save Arabic values in a variable.
for that try this:
1. You can use Arabic collations

CREATE TABLE #testArabic
(
  column1 nVARCHAR(100) COLLATE Arabic_CI_AI_KS_WS
)



OR

For the field to be able to store unicode characters, you have to use the type nvarchar or ntextor nchar.
To insert the unicode characters in the database you have to send the text as unicode by using a parameter type like nvarchar / SqlDbType.NVarChar from your coding side.


Try:

@Grade nvarchar(50)
as

begin
declare @s  nvarchar(50)
set @s= N'' + @Grade
print @s



For further information, please see:
Collation and Unicode Support[^]
Set or Change the Database Collation[^]
COLLATE (Transact-SQL)[^]


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

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