Skip to content
Advertisement

Tag: xml

SQL – Remove all HTML tags in a string

In my dataset, I have a field which stores text marked up with HTML. The general format is as follows: <html><head></head><body><p>My text.</p></body></html> I could attempt to solve the problem by doing the following: However, this is not a strict rule as some of entries break W3C Standards and do not include <head> tags for example. Even worse, there could be

XML Schema totalDigits/fractionDigits vs. SQL precision/scale

I’d like to find out the correspondence between XML Schema totalDigits/fractionDigits and SQL numeric precision/scale. 1) Assume we have the following simple type: How would I represent it in SQL? Let’s assume HSQL dialect (it does not matter much). I’m interested in the most restrictive SQL type which could hold all the values from the value space of the XML

XML to SQL – Selecting multiple nodes with the same name

I have working code that can select a few values from an XML file. The problem is that I have multiple nodes with the same name. Here is a snippet of the XML:

How to count occurrences of a node in SQL XML?

I am trying to do a count on the number of occurrences of the “Colors” node but have been so far unsuccessful. Below is what I have tried so far. If I have the following logic: I get the following error: Msg 2389, Level 16, State 1, Line 50 XQuery [value()]: ‘value()’ requires a singleton (or empty sequence), found operand

Advertisement