I need to generate and XML file, but the request is it has to be without having xmlns added to each and every line, as it increases the size of the xml.Is it possible to escape it, please? I think in Oracle it was dbms_xmldom.removeAttribute function. Anything similar in MSSQL (2014), please?First I run WITH XMLNAMESPACES ( 'urn:digi-inkoop:ubl:2.0:NL:1.6:UBL-NL-CommonBasicComponents-2' AS [nl-cbc], 'urn:un:unece:uncefact:data:draft:UnqualifiedDataTypesSchemaModule:2' AS udt, 'urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2' AS ext, 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2' AS cbc, 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2' AS cac, 'http://www.w3.org/2001/XMLSchema-instance' AS xsi, 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2' AS doc, DEFAULT 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2' )Then - my SELECT statement and the result is below:--===== PART OF MY SELECT === ----SELECT @xmlstring = '<?xml version="1.0" encoding="UTF-8"?>' + (SELECT 'Text2' AS 'cbc:Name', ....FOR XML PATH('cac:AdditionalItemProperty'), ELEMENTS XSINIL)SELECT @xmlstring--========== RESULT ============---<?xml version="1.0" encoding="UTF-8"?><cac:AdditionalItemProperty xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:doc="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:udt="urn:un:unece:uncefact:data:draft:UnqualifiedDataTypesSchemaModule:2" xmlns:nl-cbc="urn:digi-inkoop:ubl:2.0:NL:1.6:UBL-NL-CommonBasicComponents-2"><cbc:Name>Text2</cbc:Name><cbc:Value>EK|J5221E|ABJ-DXB|21.12.2016|1605|0555</cbc:Value></cac:AdditionalItemProperty><cac:AdditionalItemProperty xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:doc="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:udt="urn:un:unece:uncefact:data:draft:UnqualifiedDataTypesSchemaModule:2" xmlns:nl-cbc="urn:digi-inkoop:ubl:2.0:NL:1.6:UBL-NL-CommonBasicComponents-2"><cbc:Name>Text2</cbc:Name><cbc:Value>EK|J5221E|DXB-MNL|22.12.2016|1020|2230</cbc:Value></cac:AdditionalItemProperty>
↧