Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
By Charles Jacobus,
You can use the output of this script to analyze how a database object and even a specific column are used in the database. The results of this script are similar to the View Dependencies feature of SQL Server Management Studio. This script can be useful when making schema changes by helping you understand the scope and potential impact of those changes.
This script uses a few of SQL Server’s dynamic management views and functions. Part of the body of this script borrows from examples in Microsoft SQL Server Books Online (BOL).
The permissions required to use these views and functions will likely be granted to someone making DDL changes. (They include VIEW DEFINITION and CONTROL permissions. See BOL for the specific permissions required.) In the event that the account you run this script as doesn’t have the required permissions, one or more result sets may be empty.
To use the script, enter values for @SchemaQualifiedObjectName and (optionally) for @ColumnName, and execute it against a target database.
Sql Script to change the Login Permission
scripting a database without db owner permissions
Scripts permissions/roles for db user across all databases.
Spontaneous permission changes all of a sudden
Script database and object level permissions for all database users