So I have an xml file structured like this
<Customers>
<Customer xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/DataGenerator">
<Age>86</Age>
<CustomerId>101</CustomerId>
<Email>R_Heimbach@gmail.net</Email>
<Name>Robert Heimbach</Name>
<Orders>
...
</Orders>
</Customer><Customer xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/DataGenerator">
<Age>54</Age>
<CustomerId>102</CustomerId>
<Email>R_Heimbach@here.net</Email>
<Name>Rob Heimbach</Name>
<Orders>
...
</Orders>
</Customer></Customers>
*Replaced the orders with just "..." since they aren't important rn
And the issue I'm having with getting this data into a table is the namespaces. This is the query that I'm trying to use
INSERT INTO TestCustomers(Age, CustomerId, Email, Name)
SELECT
`TEST_XML.Customer.query('Age').value('.', 'INT'),`
`TEST_XML.Customer.query('CustomerId').value('.', 'INT'),`
`TEST_XML.Customer.query('Email').value('.', 'VARCHAR(50)'),`
`TEST_XML.Customer.query('Name').value('.', 'VARCHAR(70)')`
FROM (SELECT CAST(TEST_XML AS xml)
FROM OPENROWSET(BULK 'FilePath', SINGLE_BLOB) AS T(TEST_XML)) AS T(TEST_XML)
CROSS APPLY TEST_XML.nodes('Customers/Customer') AS TEST_XML (Customer);
And it works fine if I remove the namespaces from the data, but if I keep them it does not work and after like an hour of googling stuff, I can't find any examples of how to make this work with namespaces. I saw Xquery recommended, but I tried that and couldn't get it working, and also found very little actual information on how to use it so I don't really even know where to start there.
Any help would be appreciated, or even just a link for where to look, cause I am lost.