Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How are dependencies created in sys.expression _ dependencies?


Asked by Holland Harrington on Dec 02, 2021 FAQ



The sys.sql_expression_dependencies system view holds one record each for a user defined object which has dependency on other object within the current database. A dependency between two objects is created when one object calling the referenced object appears by name in a SQL expression of another object.
Furthermore,
The biggest difference in both examples is that with sys.sql_expression_dependencies you will get info on cross-database and cross-server dependencies which can be super helpful. However, once again I have to sound a note of caution because even sys.sql_expression_dependencies does not catch things referenced in a dynamic SQL string.
And, SQL Server 2008 database engine automatically keeps track of object dependency information whenever referencing entities are created, dropped or altered and it records this information in SQL Server system catalogs. A dependency is created between two objects when one object appears by name inside a SQL statement stored in another object.
Subsequently,
A dependency between two objects is created when one object calling the referenced object appears by name in a SQL expression of another object. There are basically two types of dependencies tracked by the database engine in SQL Server 2008 namely Schema-bound Dependency and Non-schema-bound Dependency.
In fact,
One more solution to view SQL dependency between the SQL objects is to use the SSMS feature called View Dependencies . In Object Explorer, under a database, select an object for which you want to view SQL dependency, right-click and, from the context menu, choose the View Dependencies command: