In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail the sample analysis of testing several xml for you. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
When using sql server, we will inevitably deal with the parameters of xml. Xml brings convenience to our program most of the time, but sometimes there are times when variable assignment fails. (of course, if your own xml fails the inspection of software such as xml spy, then it is not the scope of this area.)
Just test a few examples.
DECLARE @ x XML SELECT @ x ='1' SELECT @ x ='1' SELECT @ x = Nasty 1' SELECT @ x = 'one person' SELECT @ x = 'single dog Wang
Example 1:
We usually see the most examples of compiling through pressure-free. Variable assignment passes, and then query, parse, whatever you want.
Example 2:
Compilation is also passed, it seems that this is the most likely to cause misunderstanding, I always thought that the assignment in sql server is not supported with
This kind of head, so usually tell coder that if there is such a mistake, it would be better to remove the head (it will be fine, but the reason is wrong) b). In fact, the xml type is supported, it's just a scenario problem when we call a stored procedure or a parameter assignment in a statement. Sql server says I can't memorize this pot.
Example 3:
There is a problem with the compilation of this example, and the compiler throws a
Message 9402, level 16, status 1, line 8
XML analysis: line 1, character 38, cannot switch encoding
However, the difference between example 3 and example 2 is that the assignment of example 3 uses the unicode encoding method, while example 2 does not, so example 3 immediately kneels the ╮ (╯ _ ╰) ╭. So we usually found that the database parameter transmission error is due to the use of this way, so I have been tricked _ (: upload "∠) _. So it's not that we don't support it, but there's something wrong with our way of calling it.
Example 4:
Message 9420, level 16, status 1, line 9
XML parsing: line 2, character 5, illegal xml character
Hey ~ wrong again ~ this time is an illegal xml character, it seems that the code is utf-8 this does not support Chinese. So sometimes not paying attention to these details is really. / (please) / ~ ~
Example 5:
The compilation passed smoothly, this time the coding inside will be changed to GBK coding, you can support Chinese. Of course, compiling is no problem at all.
Add another example
SELECT @ x = 'traditional characters' _ (: traditional "∠) _
Is also ok, some traditional characters can also be supported in the GBK font, generally do not necessarily need to struggle with this problem. Unless there are some special symbols, it's hard to say.
Finally, encoding= "utf-8" and encoding= "UTF-8" are equivalent, and there is no case sensitivity here.
This is the end of this article on "sample Analysis of testing several xml". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.