在我的sql server数据库中插入特殊字符
回答:
对于这类问题,我很抱歉,我认为如果我直接在查询中的字符串中输入特殊字符,它就不会起作用,但它确实起作用。因此,您需要做的就是找到特殊字符,将其复制并粘贴到您的查询中,然后它就可以工作了:)
伙计们,
问题已更改:
我想在数据库中输入一个 ascii 字符,这是标准商标符号 (®),使用直接查询并正确读取!我该怎么做?
上一个问题:
如何在 SQL Server 中的 varchar 列中输入特殊字符...®(该符号下方还有一行,我无法在此处粘贴)以便正确读取。
另外,我无法在任何可以查找的地方找到该符号的字符序列?
该符号是标准的®符号,挂在顶部,下面有一条线,就像下划线一样。
谢谢
编辑1:我说的是对数据库的直接查询。
ANSWER :
Sorry about the this sort of question guys, I assumed that it wouldn't work if I directly enter the special character into my string in query but it does. so all you need to do is locate the special character, copy it and paste it into your query and it works :)
folks,
QUESTION CHANGED:
I want to enter a ascii character in the database which is the standard trademark symbol (®) using a direct query and have it read correctly ! how can i do this ?
PREVIOUS QUESTION:
how can i enter a special character in SQL Server in varchar column... ® (there is also a line below this symbol which I am unable to paste here) so that it is read correctly.
Also, I am unable to find the character sequence for that symbol any places where I can look for ?
The symbol is standard ® symbol which hangs on the top and there is a line below it just like an underscore.
Thanks
EDIT 1: I am talking about a direct query to the database.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用以下 T-SQL 查询:
®
是带有代码0x00AE
的 Unicode 字符,但是当然 - 因为这是一个 Unicode 字符,所以您要插入的列 < strong>必须类型为
NVARCHAR
(不是VARCHAR
)You can use this T-SQL query:
®
is the Unicode character with code0x00AE
But of course - since this is a Unicode character, the column you're inserting into must be of type
NVARCHAR
(notVARCHAR
)您可以在存储到数据库之前将其转换为 Unicode NCR 格式,或者只是使用您所使用语言的相关函数对其进行编码,例如 JavaScript 的
encodeuricomponent
、PHP 的 urlencode。You can convert it to Unicode NCR format before you store to database, or just encode it with related functions of the language you are using , like JavaScript's
encodeuricomponent
, PHP's urlencode.您可以在数据前面使用“N”。
此查询可能对您有帮助。
You can use 'N' ahead of data.
This query might be helpful to you.