sqlcmd for xml

Posted on 2014-08-28
Last Modified: 2014-08-31
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.
Question by:Wayne Atherton
    LVL 4

    Accepted Solution

    One continuous string doesn't necessarily mean it's not well-formed XML.  Are the tags and structure correct?
    LVL 1

    Author Closing Comment

    by:Wayne Atherton
    Indeed, XML spy was opening it up in one string, switching to the grid mode, then back again reformatted. Odd.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
    Introduced in Microsoft SQL Server 2005, the Copy Database Wizard ( is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    Via a live example, show how to setup several different housekeeping processes for a SQL Server.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now