I have this little SQL script:
CREATE PROCEDURE Something
AS
EXEC SomethingNotExist;
Normally SQL Server Management Studio gives 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 give the message, while SQLCMD GO (https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-utility) writes 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?
Actually my goal would be to not write it out, as creating a database with thousands of procedures gives thousands of this message. But if i know the difference i would be happy too.