How to shred and import XML into SQL Server from the Command Line

Easily import XML data into an SQL Server database from the command line.

In addition to making it very easy to shred and import XML data into SQL Server with a Wizard interface, Exult SQL Server also includes a command line interface using which you can create batch jobs to import the XML. This HOWTO takes you through the steps to accomplish the task after.

  • The command line interface to Exult SQL Server is called Exultcmd.exe and is installed in the same location as Exultsql.exe. Executing the program without any arguments or options shows the full usage syntax.

    Exult SQL Server Command Line

  • The syntax for importing one or more XML files into SQL Server is as follows:
    Exultcmd.exe ConnectionString InputXMLFile
    
  • For specifying a connection to SQL Server, use one of the forms shown below:
    • Host@: connect to default database on the default instance on the specified Host.
    • Host@Database: connect to specified Database on the default instance on the specified Host.
    • Host\Instance@: connect to the default database on the specified Instance on the specified Host.
    • Host\Instance@Database: connect to specified Database on the specified Instance on the specified Host.
    • Host\Instance,Port@Database: Specify the Port number to connect to. This is the complete syntax for specifying a connection string.
  • Note: To list the available instances and databases on a specified host, run this command on the server where SQL Server is installed. This command looks inside the Windows Registry to get the instance information.
    Exultcmd.exe -L
    
    Listing available instances of SQL Server when
       importing XML into SQL Server using Exult SQL Server Command
       Line
  • To use Windows Authentication to connect to SQL Server, you should not specify a username or a password.

    Using Windows Authentication when importing XML into SQL
       Server using Exult SQL Server Command Line

  • Specifying a username and a password uses SQL Server authentication to connect to SQL Server.

    Using SQL Server Authentication when importing
     XML using Exult SQL Server Command Line

  • Specify the XML file to be imported into SQL Server after the connection string.

    Using
 Windows Authentication when importing XML into SQL Server using Exult
 SQL Server Command Line

  • To import multiple XML files, just specify the list of files one after another. You could also specify a wildcard such as *.xml

    Importing multiple XML files using Exult SQL Server Command
 Line

  • You could also specify a wildcard such as *.xml

    Specifying a wildcard to import multiple XML
     files using Exult SQL Server Command Line

  • Importing the XML into SQL Server. If the files are large, the processing could take some time. Hit CTRL-BREAK to abort the import.

    Importing XML into SQL Server using Exult SQL
       Server Command Line

See Also

Swift XML Converter

Query & extract XML data into Microsoft Excel (XLS), Microsoft Access (MDB or ACCDB), or CSV.

Exult Standard

Convert XML into Microsoft Excel (XLS), Microsoft Access (MDB or ACCDB), or CSV.

Exult SQL Server

Shred and import XML into SQL Server.

Exult MySQL

Import XML data into automatically created MySQL tables.

Exult Oracle

Import XML into Oracle.