sqlcmd for xml

I have an external .sql file which works 100% is SSMS, which produces well formed xml. However, as soon as I try and create a sql job the out put is on continous string, as apposed to well formed xml.

here is the cmd being called inside the job:

sqlcmd -X -h-1 -y 0 -i "D:\API\Export\MessagesXML.sql" -d dbname -S localhost\instance -o "D:\API\Export\Messages.xml"

This is being run as a 'Operating System (CmdExec) job, any help would be appreciated.
Wayne AthertonProduct Analyst Financial Messaging LondonAsked:
Who is Participating?
Randy Knight, MCMPrincipal ConsultantCommented:
One continuous string doesn't necessarily mean it's not well-formed XML.  Are the tags and structure correct?
Wayne AthertonProduct Analyst Financial Messaging LondonAuthor Commented:
Indeed, XML spy was opening it up in one string, switching to the grid mode, then back again reformatted. Odd.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.