You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[!INCLUDE[SQL Server Azure SQL Database Synapse Analytics PDW ](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
26
26
The visibility of metadata is limited to securables that a user either owns or on which the user has been granted some permission. For example, the following query returns a row if the user has been granted a permission such as SELECT or INSERT on the table `myTable`.
27
27
28
-
```
28
+
```sql
29
29
SELECT name, object_id
30
30
FROMsys.tables
31
31
WHERE name = N'myTable';
@@ -79,9 +79,9 @@ GO
79
79
80
80
- Queries on system views might only return a subset of rows, or sometimes an empty result set.
81
81
82
-
- Metadata-emitting, built-in functions such as OBJECTPROPERTYEX may return NULL.
82
+
- Metadata-emitting, built-in functions such as OBJECTPROPERTYEX may return `NULL`.
83
83
84
-
- The [!INCLUDE[ssDE](../../includes/ssde-md.md)]**sp_help** stored procedures might return only a subset of rows, or NULL.
84
+
- The [!INCLUDE[ssDE](../../includes/ssde-md.md)]`sp_help` stored procedures might return only a subset of rows, or `NULL`.
85
85
86
86
SQL modules, such as stored procedures and triggers, run under the security context of the caller and, therefore, have limited metadata accessibility. For example, in the following code, when the stored procedure tries to access metadata for the table `myTable` on which the caller has no rights, an empty result set is returned. In earlier releases of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], a row is returned.
87
87
@@ -95,7 +95,7 @@ END;
95
95
GO
96
96
```
97
97
98
-
To allow callers to view metadata, you can grant the callers VIEW DEFINITION permission at an appropriate scope: object level, database level or server level. Therefore, in the previous example, if the caller has VIEW DEFINITION permission on `myTable`, the stored procedure returns a row. For more information, see [GRANT (Transact-SQL)](../../t-sql/statements/grant-transact-sql.md) and [GRANT Database Permissions (Transact-SQL)](../../t-sql/statements/grant-database-permissions-transact-sql.md).
98
+
To allow callers to view metadata, you can grant the callers VIEW DEFINITION permission at an appropriate scope: object level, database level, or server level. Therefore, in the previous example, if the caller has VIEW DEFINITION permission on `myTable`, the stored procedure returns a row. For more information, see [GRANT (Transact-SQL)](../../t-sql/statements/grant-transact-sql.md) and [GRANT Database Permissions (Transact-SQL)](../../t-sql/statements/grant-database-permissions-transact-sql.md).
99
99
100
100
You can also modify the stored procedure so that it executes under the credentials of the owner. When the procedure owner and the table owner are the same owner, ownership chaining applies, and the security context of the procedure owner enables access to the metadata for `myTable`. Under this scenario, the following code returns a row of metadata to the caller.
101
101
@@ -124,13 +124,13 @@ GO
124
124
125
125
The following metadata is not subject to forced disclosure:
126
126
127
-
- The value stored in the `provider_string` column of `sys.servers`. A user that does not have ALTER ANY LINKED SERVER permission will see a NULL value in this column.
127
+
- The value stored in the `provider_string` column of `sys.servers`. A user that does not have **ALTER ANY LINKED SERVER** permission will see a `NULL` value in this column.
128
128
129
129
- Source definition of a user-defined object such as a stored procedure or trigger. The source code is visible only when one of the following is true:
130
130
131
-
- The user has VIEW DEFINITION permission on the object.
131
+
- The user has **VIEW DEFINITION** permission on the object.
132
132
133
-
- The user has not been denied VIEW DEFINITION permission on the object and has CONTROL, ALTER, or TAKE OWNERSHIP permission on the object. All other users will see NULL.
133
+
- The user has not been denied **VIEW DEFINITION** permission on the object and has **CONTROL**, **ALTER**, or **TAKE OWNERSHIP** permission on the object. All other users will see `NULL`.
134
134
135
135
- The definition columns found in the following catalog views:
136
136
@@ -148,16 +148,16 @@ GO
148
148
149
149
- The following columns in the information schema views:
- The value stored in the password_hash column of `sys.sql_logins`. A user that does not have CONTROL SERVER permission will see a NULL value in this column.
160
+
- The value stored in the password_hash column of `sys.sql_logins`. A user that does not have **CONTROL SERVER** permission will see a `NULL` value in this column.
161
161
162
162
> [!NOTE]
163
163
> The SQL definitions of built-in system procedures and functions are publicly visible through the `sys.system_sql_modules` catalog view, the `sp_helptext` stored procedure, and the OBJECT_DEFINITION() function.
@@ -180,20 +180,20 @@ GO
180
180
Metadata that can be accessed by fixed roles depends upon their corresponding implicit permissions.
181
181
182
182
### Scope of Permissions
183
-
Permissions at one scope imply the ability to see metadata at that scope and at all enclosed scopes. For example, SELECT permission on a schema implies that the grantee has SELECT permission on all securables that are contained by that schema. The granting of SELECT permission on a schema therefore enables a user to see the metadata of the schema and also all tables, views, functions, procedures, queues, synonyms, types, and XML schema collections within it. For more information about scopes, see [Permissions Hierarchy (Database Engine)](../../relational-databases/security/permissions-hierarchy-database-engine.md).
183
+
Permissions at one scope imply the ability to see metadata at that scope and at all enclosed scopes. For example, **SELECT** permission on a schema implies that the grantee has **SELECT** permission on all securables that are contained by that schema. The granting of **SELECT** permission on a schema therefore enables a user to see the metadata of the schema and also all tables, views, functions, procedures, queues, synonyms, types, and XML schema collections within it. For more information about scopes, see [Permissions Hierarchy (Database Engine)](../../relational-databases/security/permissions-hierarchy-database-engine.md).
184
184
185
185
> [!NOTE]
186
-
> The UNMASK permission does not influence metadata visibility: granting UNMASK alone will not disclose any Metadata. UNMASK will always need to be accompanied by a SELECT permission to have any effect. Example: granting UNMASK on database scope and granting SELECT on an individual Table will have the result that the user can only see the metadata of the individual table from which he can select, not any others.
186
+
> The **UNMASK** permission does not influence metadata visibility: granting **UNMASK** alone will not disclose any Metadata. **UNMASK** will always need to be accompanied by a **SELECT** permission to have any effect. Example: granting **UNMASK** on database scope and granting **SELECT** on an individual Table will have the result that the user can only see the metadata of the individual table from which they can select, not any others.
187
187
188
188
### Precedence of DENY
189
-
DENY typically takes precedence over other permissions. For example, if a database user is granted EXECUTE permission on a schema but has been denied EXECUTE permission on a stored procedure in that schema, the user cannot view the metadata for that stored procedure.
189
+
**DENY** typically takes precedence over other permissions. For example, if a database user is granted **EXECUTE** permission on a schema but has been denied **EXECUTE** permission on a stored procedure in that schema, the user cannot view the metadata for that stored procedure.
190
190
191
-
Additionally, if a user is denied EXECUTE permission on a schema but has been granted EXECUTE permission on a stored procedure in that schema, the user cannot view the metadata for that stored procedure.
191
+
Additionally, if a user is denied **EXECUTE** permission on a schema but has been granted **EXECUTE** permission on a stored procedure in that schema, the user cannot view the metadata for that stored procedure.
192
192
193
-
For another example, if a user has been granted and denied EXECUTE permission on a stored procedure, which is possible through your various role memberships, DENY takes precedence and the user cannot view the metadata of the stored procedure.
193
+
For another example, if a user has been granted and denied **EXECUTE** permission on a stored procedure, which is possible through your various role memberships, **DENY** takes precedence and the user cannot view the metadata of the stored procedure.
194
194
195
195
### Visibility of Subcomponent Metadata
196
-
The visibility of subcomponents, such as indexes, check constraints, and triggers is determined by permissions on the parent. These subcomponents do not have grantable permissions. For example, if a user has been granted some permission on a table, the user can view the metadata for the tables, columns, indexes, check constraints, triggers, and other such subcomponents. Another example is granting SELECT on only an individual column of a given table: this will allow the grantee to view the matadata of the whole table, including all columns. One way to think of it, is that the VIEW DEFINITION permission only works on entity-level (the table in this case) and is not available for Sub-entity lists (such as column or security expressions).
196
+
The visibility of subcomponents, such as indexes, check constraints, and triggers is determined by permissions on the parent. These subcomponents do not have grantable permissions. For example, if a user has been granted some permission on a table, the user can view the metadata for the tables, columns, indexes, check constraints, triggers, and other such subcomponents. Another example is granting **SELECT** on only an individual column of a given table: this will allow the grantee to view the metadata of the whole table, including all columns. One way to think of it, is that the **VIEW DEFINITION** permission only works on entity-level (the table in this case) and is not available for Sub-entity lists (such as column or security expressions).
## <aname="Top"></a> View the definition of a stored procedure
23
23
24
-
This topic describes how to view the definition of procedure in Object Explorer and by using a system stored procedure, system function, and object catalog view in the Query Editor.
24
+
This article describes how to view the definition of procedure in Object Explorer and by using a system stored procedure, system function, and object catalog view in the Query Editor.
25
25
26
26
-**Before you begin:**[Security](#Security)
27
27
@@ -33,10 +33,10 @@ This topic describes how to view the definition of procedure in Object Explorer
33
33
34
34
#### <aname="Permissions"></a> Permissions
35
35
System Stored Procedure: **sp_helptext**
36
-
Requires membership in the **public** role. System object definitions are publicly visible. The definition of user objects is visible to the object owner or grantees that have any one of the following permissions: ALTER, CONTROL, TAKE OWNERSHIP, or VIEW DEFINITION.
36
+
Requires membership in the **public** role. System object definitions are publicly visible. The definition of user objects is visible to the object owner or grantees that have any one of the following permissions: **ALTER**, **CONTROL**, **TAKE OWNERSHIP**, or **VIEW DEFINITION**.
37
37
38
38
System Function: **OBJECT_DEFINITION**
39
-
System object definitions are publicly visible. The definition of user objects is visible to the object owner or grantees that have any one of the following permissions: ALTER, CONTROL, TAKE OWNERSHIP, or VIEW DEFINITION. These permissions are implicitly held by members of the **db_owner**, **db_ddladmin**, and **db_securityadmin** fixed database roles.
39
+
System object definitions are publicly visible. The definition of user objects is visible to the object owner or grantees that have any one of the following permissions: **ALTER**, **CONTROL**, **TAKE OWNERSHIP**, or **VIEW DEFINITION**. These permissions are implicitly held by members of the **db_owner**, **db_ddladmin**, and **db_securityadmin** fixed database roles.
40
40
41
41
Object Catalog View: **sys.sql_modules**
42
42
The visibility of the metadata in catalog views is limited to securables that a user either owns or on which the user has been granted some permission. For more information, see [Metadata Visibility Configuration](../../relational-databases/security/metadata-visibility-configuration.md).
@@ -58,7 +58,7 @@ This topic describes how to view the definition of procedure in Object Explorer
58
58
59
59
2. Expand **Databases**, expand the database in which the procedure belongs, and then expand **Programmability**.
60
60
61
-
3. Expand **Stored Procedures**, right-click the procedure and then click**Script Stored Procedure as**, and then click one of the following: **Create To**, **Alter To**, or **Drop and Create To**.
61
+
3. Expand **Stored Procedures**, right-click the procedure and then select**Script Stored Procedure as**, and then select one of the following: **Create To**, **Alter To**, or **Drop and Create To**.
62
62
63
63
4. Select **New Query Editor Window**. This will display the procedure definition.
64
64
@@ -69,7 +69,7 @@ This topic describes how to view the definition of procedure in Object Explorer
69
69
System Stored Procedure: **sp_helptext**
70
70
1. In Object Explorer, connect to an instance of the [!INCLUDE[ssDE](../../includes/ssde-md.md)].
71
71
72
-
2. On the toolbar, click**New Query**.
72
+
2. On the toolbar, select**New Query**.
73
73
74
74
3. In the query window, enter the following statement that uses the `sp_helptext` system stored procedure. Change the database name and stored procedure name to reference the database and stored procedure that you want.
75
75
@@ -83,7 +83,7 @@ This topic describes how to view the definition of procedure in Object Explorer
83
83
84
84
1. In Object Explorer, connect to an instance of the [!INCLUDE[ssDE](../../includes/ssde-md.md)].
85
85
86
-
2. On the toolbar, click**New Query**.
86
+
2. On the toolbar, select**New Query**.
87
87
88
88
3. In the query window, enter the following statements that use the `OBJECT_DEFINITION` system function. Change the database name and stored procedure name to reference the database and stored procedure that you want.
89
89
@@ -97,7 +97,7 @@ This topic describes how to view the definition of procedure in Object Explorer
97
97
98
98
1. In Object Explorer, connect to an instance of the [!INCLUDE[ssDE](../../includes/ssde-md.md)].
99
99
100
-
2. On the toolbar, click**New Query**.
100
+
2. On the toolbar, select**New Query**.
101
101
102
102
3. In the query window, enter the following statements that use the `sys.sql_modules` catalog view. Change the database name and stored procedure name to reference the database and stored procedure that you want.
> The system stored procedure `sp_helptext` is not supported in Azure Synapse Analytics. Instead, use `OBJECT_DEFINITION` system function or `sys.sql_modules` object catalog view for equivalent results.
57
56
58
57
## Permissions
59
-
Requires membership in the **public** role. System object definitions are publicly visible. The definition of user objects is visible to the object owner or grantees that have any one of the following permissions: ALTER, CONTROL, TAKE OWNERSHIP, or VIEW DEFINITION.
58
+
Requires membership in the **public** role. System object definitions are publicly visible. The definition of user objects is visible to the object owner or grantees that have any one of the following permissions: **ALTER**, **CONTROL**, **TAKE OWNERSHIP**, or **VIEW DEFINITION**.
0 commit comments