Question

i want to append a line of text to a text file in SQLCMD The line of text is 'Have a nice day' i have following command prompt.

SQLCMD -STest -Usa -PPassword1 -i" have a nice day" >> c:\log.txt

Était-ce utile?

La solution

The solution is to create a batch file (.bat) with your SQLCMD command followed by a ECHO command and run this file.

The contents of the file should be something like this:

SQLCMD -STest -Usa -PPassword1 >> C:\log.txt

ECHO "Have a nice day!" >> C:\log.txt

You can also try to play with @ECHO ON or @ECHO OFF at the beginning of the file depending if you run the .bat file from Command Prompt.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top