i need help with sql query. I have table with column, where is stored xml as nvarchar.
| XmlCurves |
|---|
<?xml version="1.0" encoding="Windows-1252"?> |
All XML looks like:
<?xml version="1.0" encoding="Windows-1252"?>
<Curve xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Anchor>Begin</Anchor>
<LoadOnlyNOKCurves>false</LoadOnlyNOKCurves>
<Teachmode>false</Teachmode>
<ActualCurve>
<FloatPoints>0;4.965425|0.01004791;5.438642|0.01076508;5.50529|0.01112366;5.485298</FloatPoints>
</ActualCurve>
<AbsOffset>
<X>88.21842</X>
<Y>0</Y>
</AbsOffset>
<UpperLimit>
<FloatPoints>9.456265E-05;5.023251|0.008893617;5.502031</FloatPoints>
</UpperLimit>
<LowerLimit>
<FloatPoints>0.0008510638;4.906321|0.01408511;5.495711</FloatPoints>
</LowerLimit>
<ULViolationCurveIdx>-1</ULViolationCurveIdx>
<ULViolationULIdx>-1</ULViolationULIdx>
<LLViolationCurveIdx>-1</LLViolationCurveIdx>
<LLViolationLLIdx>-1</LLViolationLLIdx>
<SIO_X>
<Id>1</Id>
<Alias>Position</Alias>
<Unit>mm</Unit>
</SIO_X>
<SIO_Y>
<Id>2</Id>
<Alias>Force</Alias>
<Unit>kN</Unit>
</SIO_Y>
</Curve>
And i need built SQL query, which select data in first tag FloatPoints: <FloatPoints>0;4.965425|0.01004791;5.438642|0.01076508;5.50529|0.01112366;5.485298</Floatpoint>
For explanation:
<FloatPoints>x1;y1|x2;y2|x3;y3|x4;y4</FloatPoints>
Therefore, I would like this result:
| x1 | y1 | x2 | y2 | x3 | y3 | x4 | y4 |
|---|---|---|---|---|---|---|---|
| 0 | 4.965425 | 0.01004791 | 5.438642 | 0.01076508 | 5.50529 | 0.01112366 | 5.485298 |
If at all possible.
nvarcharwhen there's anxmldata type.varcharvalue'number'in them? If so, I don't see why you need to read the XML do that that, you could just doSELECT 'number' AS x1, 'number' AS y1, ..., 'number' AS x4, 'number' AS y4;