If I have two trivial stored procedures, created like so:
create procedure root as
select 1
go
create procedure dependant as
exec root
go
(Where dependant
depends on root
).
When I check the sys.sql_dependencies
table for the second procedure, I see an entry (as i would expect).
If, however, I add the dependant
procedure first, I get the following warning.
Cannot add rows to sys.sql_dependencies for the stored procedure because it depends on the missing table 'root'. The stored procedure will still be created; however, it cannot be successfully executed until the table exists.
And, right enough, exec dependant;
fails.
So, when I add in the root
procedure, exec dependant;
works, however, no dependency is recorded on sys.sql_dependencies
.
My questions are twofold:
- What are the consequences of this?
- Everything seems to hang together quite acceptably, so why doesn't SQL add this record retrospectively?
Help, as always is much appreciated.