Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1080609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:03:35+00:00 2026-05-16T22:03:35+00:00

If I have two trivial stored procedures, created like so: create procedure root as

  • 0

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:

  1. What are the consequences of this?
  2. Everything seems to hang together quite acceptably, so why doesn’t SQL add this record retrospectively?

Help, as always is much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:03:35+00:00Added an answer on May 16, 2026 at 10:03 pm

    The consequences are just that when you come to refactor the database it is more difficult to identify affected objects.

    You can refresh all dependencies by writing a script to run sp_refreshsqlmodule on all database objects.

    In SQL Server 2008 such unresolved dependencies are still stored and are accessible through sys.sql_expression_dependencies meaning the dependency information is more reliable.

    The SQL Server 2008 behaviour is as follows.

    After dependant is created but before root exists

    SELECT     OBJECT_NAME(referencing_id) AS Name, 
               referencing_class_desc, 
               referenced_class_desc, 
               referenced_entity_name, 
               referenced_id, 
               is_caller_dependent, 
               is_ambiguous
    FROM         sys.sql_expression_dependencies
    

    Returns

    Name       referenced_entity_name    referenced_id is_caller_dependent is_ambiguous
    ---------- ------------------------- ------------- ------------------- ------------
    dependant  root                      NULL          1                   0
    

    In your example code this is also the results of the query following the creation of root as the reference to it is not schema qualified and so is caller dependent. However if the definition of your dependant procedure is changed to

    create procedure dependant as
    exec dbo.root
    

    Then once dbo.root is created the following is returned

    Name       referenced_entity_name    referenced_id is_caller_dependent is_ambiguous
    ---------- ------------------------- ------------- ------------------- ------------
    dependant  root                      2121058592    0                   0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have two types of documents stored in my CouchDB database. First
This I'm assuming is a relatively trivial problem. I have two connected sortable lists,
I have a snippet to create a 'Like' button for our news site: <iframe
Should be kind of trivial but say I have two jar files in libA.jar
I have two results and like to get the best order of both these.
I have two applications written in Java that communicate with each other using XML
I have two arrays of animals (for example). $array = array( array( 'id' =>
I have two arrays of System.Data.DataRow objects which I want to compare. The rows
I have two elements: <input a> <input b onclick=...> When b is clicked, I
I have two identical tables and need to copy rows from table to another.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.