Subscribe to
Posts
Comments

SQLCmd is a very handy tool used to execute SQL script automatically and output results to a file. Here is an example:

sqlcmd -S “ServerName” -U “UID” -P “PWD” -d “DBName” -i “c:\input.txt” -o “c:\output.txt” -s “,” -h -1

The parameter names in command line are case sensitive. So -D is different from -d. As shown in the example most of the parameters are self-explanatory. You can use SQLCmd /? to display all applicable parameters. Parameter -h -1 instructs the utility not to output result set header. Parameter -s “,” instructs the utility to use comma as column separator. The default is to a space.


Related Posts:

  • How to Connect to SQL Server Running on Non Standard Port
  • Look Here if None of The Permalink Solutions is Working For You
  • Setting up The Top 10 Best Plugins
  • How to Test Numeric Value in XSL Style Sheet
  • How to Solve Problem That Excel Data Imported Into SQL Server Via DTS Became Null


  • 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...

    RSS feed | Trackback URI

    Comments »

    No comments yet.

    Name (required)
    E-mail (required - never shown publicly)
    URI
    Subscribe to comments via email
    Your Comment (smaller size | larger size)
    You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.