如何在sql server中插入卢比符号 [英] How to insert rupee symbol in sql server

查看:126
本文介绍了如何在sql server中插入卢比符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



请告诉我在sql server中插入当前卢比符号的查询。

我必须显示所有货币组合框中的符号。



Hi all

Please tell me the query to insert current rupee symbol in sql server.
I have to display all the currency symbols in a combo box.

INSERT INTO dbo.currency (country,currency,code,symbol) VALUES ('India','Rupees','INR',NCHAR(8425));     





我尝试了以上但是它没有显示输出。



谢谢你



I tried the above but it's not showing the output.

Thank you

推荐答案

由于Rupee是一个unicode符号,你需要使用一个包含这个字形的字体。正如我所见,默认情况下不支持在Window中,您必须应用补丁: http://support.microsoft.com/ kb / 2496898 [ ^ ]。但这还不够,您必须在SQL Server Management Studio中更改网格结果的字体并选择正确的字体( http://technet.microsoft.com/en-us/library/ms189708.aspx [ ^ ])。要检查符号字形是否可用,请启动charmap.exe并搜索代码20B9(请参阅: http://windows.microsoft.com/en-us/windows-vista/using-special-characters-character-map-frequently-asked-questions [ ^ ])



更新:

1)使用Tahoma字体。更新后,它肯定支持符号。

2)您使用的代码似乎不是INR符号unicode代码。它应该是8377(这个十进制值相当于十六进制20B9)。如果你运行以下语句,你应该亲自看看:

As Rupee is a unicode symbol, you need to use a font that is having this glyph in it. As I see, it is not supported by default in Window, you have to apply a patch: http://support.microsoft.com/kb/2496898[^]. But this is not enough, you have to change the font of the grid result in SQL Server Management Studio and choose a proper font (http://technet.microsoft.com/en-us/library/ms189708.aspx[^]). To check if the symbol glyph is available or not, start charmap.exe and search for the code 20B9 (see: http://windows.microsoft.com/en-us/windows-vista/using-special-characters-character-map-frequently-asked-questions[^])

Update:
1) Use "Tahoma" font. After the update it is for sure supporting the symbol.
2) The code you have used seems not to be the INR symbol unicode code. It should be 8377 (this decimal value is equivalent with hex 20B9). If you run following statements, you should see for yourself:
select UNICODE(N'₹'), NCHAR(8377)


见这里:

如何从查询窗口向SQL Server插入unicode文本 [ ^ ]



这将导致:

See here:
how to insert unicode text to SQL Server from query window[^]

Which would lead to:
INSERT INTO dbo.currency (country, currency,code, symbol) VALUES ('India', 'Rupees', 'INR', N'₨');





注意:文本列必须是nvarchar或nchar类型。



Note: the text column has to be of type nvarchar or nchar.


只需添加到Zoltan Zargo提到的解决方案#3



在大多数情况下,SQL Server Script文件设置为西欧(Windows) - 代码页1252编码。因此,INR卢比符号通常不会正确显示。在脚本编辑器中选择的默认字体可能允许显示字符,但在保存脚本文件时,SSMS将指示异常。



因此,在不改变编码的情况下,您可以简单地采用NCHAR函数。例如(扩展到前面已经在线程中指出的内容),显示了如何实现这一点的各种方法:



Just to add to the Solution #3 mentioned by Zoltan Zargo

In most cases, SQL Server Script files are set to the "Western European (Windows) - Codepage 1252" encoding. Hence, the INR rupee symbol does not often appear correctly. The default font chosen in the Script Editor might allow the display of the character, but while saving the script file, SSMS will indicate the anomaly.

Hence, without altering the encoding, you could simply adopt the NCHAR function. For example (extending upon what has already been pointed out earlier in the thread), shows the various ways how this could be achieved:

select UNICODE(N'₹'), NCHAR(8377), 'INR ' + NCHAR(8377)





希望这会有所帮助。



Hope this helps.


这篇关于如何在sql server中插入卢比符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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