Skip to content

Commit ef04b05

Browse files
Merge pull request #29411 from rwestMSFT/rw-1227-fix-9658-9659
Fix data types in extended property articles and fix PR 9658 and 9659
2 parents 98ce208 + ba0bf32 commit ef04b05

3 files changed

Lines changed: 46 additions & 46 deletions

File tree

docs/relational-databases/system-stored-procedures/sp-addextendedproperty-transact-sql.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Adds a new extended property to a database object.
44
author: markingmyname
55
ms.author: maghan
66
ms.reviewer: randolphwest
7-
ms.date: 08/30/2023
7+
ms.date: 12/27/2023
88
ms.service: sql
99
ms.subservice: system-objects
1010
ms.topic: "reference"
@@ -146,7 +146,7 @@ Extended properties are replicated only in the initial synchronization between t
146146

147147
## Schema versus user
148148

149-
We don't recommend specifying `USER` as a level-0 type when you apply an extended property to a database object, because this can cause name resolution ambiguity. For example, assume user `Mary` owns two schemas (`Mary` and `MySchema`), and these schemas both contain a table named `MyTable`. If Mary adds an extended property to table `MyTable` and specifies `@level0type = N'USER', @level0name = Mary`, it isn't clear to which table the extended property is applied. To maintain backward compatibility, [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] applies the property to the table that is contained in the schema named `Mary`.
149+
We don't recommend specifying `USER` as a level-0 type when you apply an extended property to a database object, because this can cause name resolution ambiguity. For example, assume user `Mary` owns two schemas (`Mary` and `MySchema`), and these schemas both contain a table named `MyTable`. If Mary adds an extended property to table `MyTable` and specifies `@level0type = 'USER', @level0name = N'Mary'`, it isn't clear to which table the extended property is applied. To maintain backward compatibility, [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] applies the property to the table that is contained in the schema named `Mary`.
150150

151151
## Permissions
152152

@@ -179,9 +179,9 @@ GO
179179

180180
EXEC sp_addextendedproperty @name = N'Caption',
181181
@value = 'Postal code is a required column.',
182-
@level0type = N'Schema', @level0name = 'Person',
183-
@level1type = N'Table', @level1name = 'Address',
184-
@level2type = N'Column', @level2name = 'PostalCode';
182+
@level0type = 'SCHEMA', @level0name = N'Person',
183+
@level1type = 'TABLE', @level1name = N'Address',
184+
@level2type = 'COLUMN', @level2name = N'PostalCode';
185185
GO
186186
```
187187

@@ -195,9 +195,9 @@ GO
195195

196196
EXEC sp_addextendedproperty @name = N'Input Mask ',
197197
@value = '99999 or 99999-9999 or #### ###',
198-
@level0type = N'Schema', @level0name = 'Person',
199-
@level1type = N'Table', @level1name = 'Address',
200-
@level2type = N'Column', @level2name = 'PostalCode';
198+
@level0type = 'SCHEMA', @level0name = N'Person',
199+
@level1type = 'TABLE', @level1name = N'Address',
200+
@level2type = 'COLUMN', @level2name = N'PostalCode';
201201
GO
202202
```
203203

@@ -211,7 +211,7 @@ GO
211211

212212
EXEC sys.sp_addextendedproperty @name = N'MS_DescriptionExample',
213213
@value = N'Primary filegroup for the AdventureWorks2022 sample database.',
214-
@level0type = N'FILEGROUP', @level0name = 'PRIMARY';
214+
@level0type = 'FILEGROUP', @level0name = N'PRIMARY';
215215
GO
216216
```
217217

@@ -225,7 +225,7 @@ GO
225225

226226
EXEC sys.sp_addextendedproperty @name = N'MS_DescriptionExample',
227227
@value = N'Contains objects related to employees and departments.',
228-
@level0type = N'SCHEMA', @level0name = 'HumanResources';
228+
@level0type = 'SCHEMA', @level0name = N'HumanResources';
229229
```
230230

231231
### F. Add an extended property to a table
@@ -238,8 +238,8 @@ GO
238238

239239
EXEC sys.sp_addextendedproperty @name = N'MS_DescriptionExample',
240240
@value = N'Street address information for customers, employees, and vendors.',
241-
@level0type = N'SCHEMA', @level0name = 'Person',
242-
@level1type = N'TABLE', @level1name = 'Address';
241+
@level0type = 'SCHEMA', @level0name = N'Person',
242+
@level1type = 'TABLE', @level1name = N'Address';
243243
GO
244244
```
245245

@@ -257,7 +257,7 @@ GO
257257

258258
EXEC sys.sp_addextendedproperty @name = N'MS_Description',
259259
@value = N'Application Role for the Purchasing Department.',
260-
@level0type = N'USER', @level0name = 'Buyers';
260+
@level0type = 'USER', @level0name = N'Buyers';
261261
```
262262

263263
### H. Add an extended property to a type
@@ -270,8 +270,8 @@ GO
270270

271271
EXEC sys.sp_addextendedproperty @name = N'MS_Description',
272272
@value = N'Data type (alias) to use for any column that represents an order number. For example a sales order number or purchase order number.',
273-
@level0type = N'SCHEMA', @level0name = N'dbo',
274-
@level1type = N'TYPE', @level1name = N'OrderNumber';
273+
@level0type = 'SCHEMA', @level0name = N'dbo',
274+
@level1type = 'TYPE', @level1name = N'OrderNumber';
275275
```
276276

277277
### I. Add an extended property to a user
@@ -287,10 +287,10 @@ GO
287287

288288
EXEC sys.sp_addextendedproperty @name = N'MS_Description',
289289
@value = N'User for an application.',
290-
@level0type = N'USER', @level0name = N'CustomApp';
290+
@level0type = 'USER', @level0name = N'CustomApp';
291291
```
292292

293-
## See also
293+
## Related content
294294

295295
- [Database Engine stored procedures (Transact-SQL)](database-engine-stored-procedures-transact-sql.md)
296296
- [sys.fn_listextendedproperty (Transact-SQL)](../system-functions/sys-fn-listextendedproperty-transact-sql.md)

docs/relational-databases/system-stored-procedures/sp-dropextendedproperty-transact-sql.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: sp_dropextendedproperty drops an existing extended property.
44
author: markingmyname
55
ms.author: maghan
66
ms.reviewer: randolphwest
7-
ms.date: 11/28/2023
7+
ms.date: 12/27/2023
88
ms.service: sql
99
ms.subservice: system-objects
1010
ms.topic: "reference"
@@ -105,21 +105,21 @@ GO
105105

106106
EXEC sp_addextendedproperty @name = 'caption',
107107
@value = 'Employee ID',
108-
@level0type = 'schema',
109-
@level0name = dbo,
110-
@level1type = 'table',
111-
@level1name = 'T1',
112-
@level2type = 'column',
113-
@level2name = id;
108+
@level0type = 'SCHEMA',
109+
@level0name = N'dbo',
110+
@level1type = 'TABLE',
111+
@level1name = N'T1',
112+
@level2type = 'COLUMN',
113+
@level2name = N'id';
114114
GO
115115

116116
EXEC sp_dropextendedproperty @name = 'caption',
117-
@level0type = 'schema',
118-
@level0name = dbo,
119-
@level1type = 'table',
120-
@level1name = 'T1',
121-
@level2type = 'column',
122-
@level2name = id;
117+
@level0type = 'SCHEMA',
118+
@level0name = N'dbo',
119+
@level1type = 'TABLE',
120+
@level1name = N'T1',
121+
@level2type = 'COLUMN',
122+
@level2name = N'id';
123123
GO
124124

125125
DROP TABLE T1;

docs/relational-databases/system-stored-procedures/sp-updateextendedproperty-transact-sql.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Updates the value of an existing extended property.
44
author: markingmyname
55
ms.author: maghan
66
ms.reviewer: randolphwest
7-
ms.date: 08/28/2023
7+
ms.date: 12/27/2023
88
ms.service: sql
99
ms.subservice: system-objects
1010
ms.topic: "reference"
@@ -131,9 +131,9 @@ Given a valid *@name* and *@value*, if all object types and names are `NULL`, th
131131

132132
## Permissions
133133

134-
Members of the **db_owner** and **db_ddladmin** fixed database roles may update the extended properties of any object with the following exception: **db_ddladmin** may not add properties to the database itself, or to users or roles.
134+
Members of the **db_owner** and **db_ddladmin** fixed database roles can update the extended properties of any object with the following exception: **db_ddladmin** can't add properties to the database itself, or to users or roles.
135135

136-
Users may update extended properties to objects they own, or on which they have ALTER or CONTROL permissions.
136+
Users can update extended properties to objects they own, or on which they have ALTER or CONTROL permissions.
137137

138138
## Examples
139139

@@ -150,23 +150,23 @@ GO
150150

151151
EXEC sp_addextendedproperty @name = N'Caption',
152152
@value = N'Employee ID',
153-
@level0type = N'Schema',
154-
@level0name = dbo,
155-
@level1type = N'Table',
156-
@level1name = T1,
157-
@level2type = N'Column',
158-
@level2name = id;
153+
@level0type = 'SCHEMA',
154+
@level0name = N'dbo',
155+
@level1type = 'TABLE',
156+
@level1name = N'T1',
157+
@level2type = 'COLUMN',
158+
@level2name = N'id';
159159
GO
160160

161161
--Update the extended property.
162162
EXEC sp_updateextendedproperty @name = N'Caption',
163163
@value = 'Employee ID must be unique.',
164-
@level0type = N'Schema',
165-
@level0name = dbo,
166-
@level1type = N'Table',
167-
@level1name = T1,
168-
@level2type = N'Column',
169-
@level2name = id;
164+
@level0type = 'SCHEMA',
165+
@level0name = N'dbo',
166+
@level1type = 'TABLE',
167+
@level1name = N'T1',
168+
@level2type = 'COLUMN',
169+
@level2name = N'id';
170170
GO
171171
```
172172

@@ -190,7 +190,7 @@ EXEC sp_updateextendedproperty @name = N'NewCaption',
190190
GO
191191
```
192192

193-
## See also
193+
## Related content
194194

195195
- [Database Engine stored procedures (Transact-SQL)](database-engine-stored-procedures-transact-sql.md)
196196
- [sys.fn_listextendedproperty (Transact-SQL)](../system-functions/sys-fn-listextendedproperty-transact-sql.md)

0 commit comments

Comments
 (0)