Return value of SQLCMD

后端 未结 2 2021
轻奢々
轻奢々 2021-01-01 15:48

I need to check the exit status (success/failure) of a query run through SQLCMD utility. For example, the server I am connecting doesn\'t have a database name

2条回答
  •  失恋的感觉
    2021-01-01 16:26

    I am not sure, but did you tried SQLCMD -m switch? sqlcmd Utility

    -m error_level - Controls which error messages are sent to stdout. Messages that have a severity level greater than or equal to this level are sent. When this value is set to -1, all messages including informational messages, are sent. Spaces are not allowed between the -m and -1. For example, -m-1 is valid, and -m -1 is not.

提交回复
热议问题