How to run a sql script file using sqlcmd and output to both shell and file
问题 I'm trying to run a sql script from a file using sqlcmd , using the following command: sqlcmd -S <server> -d <database> -i <input file> -o <output file> -U <user> -P <password> I run my sql file and output to a log file. The problem is this change the output of sqlcmd to the file.. and i want to get the output also to the shell. 回答1: @Noam, There's a standard program in UNIX world that reads from stdin and writes to stdout and to a specified file: the tee command. The following example lists