After referring to those two posts - XML Output is Truncated in SQL, Generating an XML output using XML OPTIONS in SQL Server
And setting in SQL Server Management Studio (SSMS) as - Option Setting in SSMS to set XML output data to an unlimited size.
DECLARE @xmldata xml
SET @xmldata = (
SELECT
'DATE' as 'column/@name', [DATE] as 'column', null,
'ID' as 'column/@name', [ID] as 'column', null,
'NAME' as 'column/@name', [NAME] as 'column', null
FROM TEST_TBL
FOR XML PATH('row'), ROOT('resultset')
)
SELECT @xmldata AS returnXML
The XML output in SSMS is all right. But if I run SQLCMD.EXE to generate an XML output file as below,
DECLARE @xmldata xml
SET @xmldata = (
SELECT
'DATE' as 'column/@name', [DATE] as 'column', null,
'ID' as 'column/@name', [ID] as 'column', null,
'NAME' as 'column/@name', [NAME] as 'column', null
FROM TEST_TBL
FOR XML PATH('row'), ROOT('resultset')
)
SELECT @xmldata AS returnXML
:OUT abc.XML
GO
The output file - abc.XML is truncated at the length of 1,048,578 in a single row.
Is there any way to set the XML output file - abc.XML to an 'Unlimited' size as in SSMS?
Thanks for your help!