|
15 | 15 | /* |
16 | 16 | sp_doc - Always have current documentation by generating it on the fly in markdown. |
17 | 17 |
|
18 | | -Part of the DBA MultiTool http://dba-multitool.org |
| 18 | +Part of the DBA MultiTool https://dba-multitool.org |
19 | 19 |
|
20 | | -Version: 20210801 |
| 20 | +Version: 20211223 |
21 | 21 |
|
22 | 22 | MIT License |
23 | 23 |
|
@@ -289,21 +289,31 @@ BEGIN |
289 | 289 | ,(CONCAT(CHAR(13), CHAR(10), ''<details><summary>Click to expand</summary>'', CHAR(13), CHAR(10)));' + |
290 | 290 |
|
291 | 291 | + N'INSERT INTO #markdown (value) |
292 | | - SELECT CONCAT(''* ['', OBJECT_SCHEMA_NAME(object_id), ''.'', OBJECT_NAME(object_id), ''](#'', REPLACE(LOWER(OBJECT_SCHEMA_NAME(object_id)), '' '', ''-''), REPLACE(LOWER(OBJECT_NAME(object_id)), '' '', ''-''), '')'') |
293 | | - FROM [sys].[tables] |
294 | | - WHERE [type] = ''U'' |
295 | | - AND [is_ms_shipped] = 0 |
296 | | - ORDER BY OBJECT_SCHEMA_NAME([object_id]), [name] ASC;' + |
| 292 | + SELECT CONCAT(''* ['', OBJECT_SCHEMA_NAME([t].[object_id]), ''.'', OBJECT_NAME([t].[object_id]), ''](#'', REPLACE(LOWER(OBJECT_SCHEMA_NAME([t].[object_id])), '' '', ''-''), REPLACE(LOWER(OBJECT_NAME([t].[object_id])), '' '', ''-''), '')'') |
| 293 | + FROM [sys].[tables] [t] |
| 294 | + LEFT JOIN [sys].[extended_properties] [ep] ON [t].[object_id] = [ep].[major_id] |
| 295 | + AND [ep].[minor_id] = 0 --On the table |
| 296 | + AND [ep].[class] = 1 --Object or col |
| 297 | + AND [ep].[name] = ''microsoft_database_tools_support'' |
| 298 | + WHERE [t].[type] = ''U'' |
| 299 | + AND [t].[is_ms_shipped] = 0 |
| 300 | + AND [ep].[name] IS NULL --Exclude SSDT tables |
| 301 | + ORDER BY OBJECT_SCHEMA_NAME([t].[object_id]), [t].[name] ASC;' + |
297 | 302 |
|
298 | 303 | --Object details |
299 | 304 | + N'DECLARE obj_cursor CURSOR |
300 | 305 | LOCAL STATIC READ_ONLY FORWARD_ONLY |
301 | 306 | FOR |
302 | | - SELECT [object_id] |
303 | | - FROM [sys].[tables] |
304 | | - WHERE [type] = ''U'' |
305 | | - AND [is_ms_shipped] = 0 |
306 | | - ORDER BY OBJECT_SCHEMA_NAME([object_id]), [name] ASC; |
| 307 | + SELECT [t].[object_id] |
| 308 | + FROM [sys].[tables] [t] |
| 309 | + LEFT JOIN [sys].[extended_properties] [ep] ON [t].[object_id] = [ep].[major_id] |
| 310 | + AND [ep].[minor_id] = 0 --On the table |
| 311 | + AND [ep].[class] = 1 --Object or col |
| 312 | + AND [ep].[name] = ''microsoft_database_tools_support'' |
| 313 | + WHERE [t].[type] = ''U'' |
| 314 | + AND [t].[is_ms_shipped] = 0 |
| 315 | + AND [ep].[name] IS NULL --Exclude SSDT tables |
| 316 | + ORDER BY OBJECT_SCHEMA_NAME([t].[object_id]), [t].[name] ASC; |
307 | 317 |
|
308 | 318 | OPEN obj_cursor |
309 | 319 | FETCH NEXT FROM obj_cursor INTO @ObjectId |
|
0 commit comments