I have this little SQL script:
CREATE PROCEDURE Something
AS
EXEC SomethingNotExist;
Normally SQL Server Management Studio shows this message:
The module 'Something' depends on the missing object 'SomethingNotExist'. The module will still be created; however, it cannot run successfully until the object exists.
If I put the script above into an .sql
file, and run this command from CMD:
SQLCMD -S Server -d DB1 -E -i "Something.sql" -u -I -m 10 -h-1 -l 100 -r1
the two SQLCMD act differently.
The built-in SQLCMD (came with the SQL Server) does not show the message, while SQLCMD GO (https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-utility) outputs the message.
The message is the #2007 with severity level 10 at https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/database-engine-events-and-errors-2000-to-2999
I think the written (or not written) message should depend on the command line switch -m
. But the two SQLCMD act the same way with every value of -m
, both are on their own way.
Why? What is the difference? What do I do wrong?
I also tried --verbosity
with SQLCMD GO, but despite of the example in its description, it does not know this switch. Changing the value of -r
also didn't bring me the goal. Neither the --driver-logging-level
.
Actually my goal would be to not write it out with both SQLCMD, as creating a database with thousands of procedures gives thousands of this message. But if I know the difference I would be happy too.
2>&1
at the end, or remove the-r1
to-r0