I have this sampl XML
when I run this it shows columns and rows but the column have no names and the data in each row is null.
I am going to pass the XML string into a stored Procedure from .NET
DougP
when I run this it shows columns and rows but the column have no names and the data in each row is null.
I am going to pass the XML string into a stored Procedure from .NET
Code:
Declare @xmlInput xml
Set @xmlInput =('<fileData>
<row>
<EID>7747379800</EID>
<Name>Flintstone, Fred</Name>
<Email>fred@flintstone.com</Email>
<ManagerEID>123456</ManagerEID>
<Manager></Manager>
<C>USA</C>
<L>My City</L>
<SurName>Flintstone</SurName>
<State>FL</State>
</row>
<row>
<EID>7463614574</EID>
<Name>Flintstone, Wilma</Name>
<Email>wilma@graveltown.com</Email>
<ManagerEID>7747379800</ManagerEID>
<Manager>Mr Spacely</Manager>
<C>USA</C>
<L>MyTown</L>
<SurName>Flinstone</SurName>
<State>XX</State>
</row>
SELECT
T.C.value('@EID', 'nvarchar(60)'),
T.C.value('@Name', 'nvarchar(60)'),
T.C.value('@Email','nvarchar(60)'),
T.C.value('@ManagerEID', 'nvarchar(60)'),
T.C.value('@Manager', 'nvarchar(60)'),
T.C.value('@C', 'nvarchar(60)'),
T.C.value('@L', 'nvarchar(60)'),
T.C.value('@Surname', 'nvarchar(60)'),
T.C.value('@State', 'nvarchar(60)'),
FROM @xmlInput.nodes('//row') T(C)
DougP