September 9, 2014 at 9:56 am
Hi,
I need to use multiple server names in sqlcmd on command prompt
In my batch file i am using the below command
D
cd \prod
sqlcmd -S servername -E -i test\db.sql -o rpt\db.txt
sqlcmd -S servername1 -E -i test\db.sql -o rpt\db.txt
it is not working for me, it is retuned the output of servername1 only, how can i get multi servers output
Please suggest!
Thanks,
Giri
September 9, 2014 at 10:31 am
Your issue is that you are trying to output to the same file and sqlcmd doesn't support appending. From BOL:
-o output_file
Identifies the file that receives output from sqlcmd.
If -u is specified, the output_file is stored in Unicode format. If the file name is not valid, an error message is generated, and sqlcmd exits. sqlcmd does not support concurrent writing of multiple sqlcmd processes to the same file. The file output will be corrupted or incorrect. See the -f switch for more information about file formats. This file will be created if it does not exist. A file of the same name from a prior sqlcmd session will be overwritten. The file specified here is not the stdout file. If a stdout file is specified this file will not be used.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply