How to get SQLCMD to output errors and warnings only
问题 How can you get SQLCMD, when executing a SQL script file, to just output any errors or warnings it encounters? I essentially dont want information based messages to be output. 回答1: It's not possible to prevent SQLCMD returning non-error output messages by passing it a parameter. However, what you can do is redirect error messages to STDERR , then direct all other messages to NUL . This is done by passing the -r parameter. From books online: -r[ 0 | 1] msgs to stderr Redirects the error