sqlcmd; output file

I using the sqlcmd from a batch file.  I'm calling it more than once.  However, I would like the results from all calls to be in a single  output file (-o parm).

Can this be done?
LVL 1
HLRosenbergerAsked:
Who is Participating?
 
keyuCommented:
sqlcmd -S “ServerName” -U “UID” -P “PWD” -d “DBName” -i “c:\input.txt” -o “c:\output.txt” -s “,” -h -1

for more details refer below links..

http://www.siusic.com/wphchen/sqlcmd-example-to-output-in-csv-format-350.html

http://msdn.microsoft.com/en-us/library/ms162773.aspx
0
 
dbbishopCommented:
will redirection work? Remove the -o and use:
sqlcmd .... >> myoutput.txt. The double > will append to the existing file (or create it if it doesn't exist.
0
 
Ramesh Babu VavillaCommented:
hi test on my desktop check the image attached
sqlcmd out to a file tested on my desktiop
0
 
HLRosenbergerAuthor Commented:
Thanks
0
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.