@@ -90,7 +90,7 @@ Version: 20211223
9090
9191MIT License
9292
93- Copyright (c) 2022 John McCall
93+ Copyright (c) 2023 John McCall
9494
9595Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
9696documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@@ -2356,7 +2356,7 @@ Version: 20220124
23562356
23572357MIT License
23582358
2359- Copyright (c) 2022 John McCall
2359+ Copyright (c) 2023 John McCall
23602360
23612361Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
23622362documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@@ -3205,11 +3205,11 @@ sp_helpme - A drop-in modern alternative to sp_help.
32053205
32063206Part of the DBA MultiTool http://dba-multitool.org
32073207
3208- Version: 20220124
3208+ Version: 20230108
32093209
32103210MIT License
32113211
3212- Copyright (c) 2022 John McCall
3212+ Copyright (c) 2023 John McCall
32133213
32143214Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
32153215documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@@ -3570,7 +3570,58 @@ BEGIN
35703570 IF @SysObj_Type IN (' S ' ,' U ' )
35713571 BEGIN
35723572 EXEC sys .sp_objectfilegroup @ObjID;
3573+
3574+ /* Begin custom included columns for sp_helpindex */
3575+ CREATE TABLE # sp_helpindex (
3576+ index_name SYSNAME COLLATE database_default
3577+ ,index_description VARCHAR (210 )
3578+ ,index_keys NVARCHAR(2126 ) COLLATE database_default -- Length (16*max_identifierLength)+(15*2)+(16*3)
3579+ ,index_includes NVARCHAR(MAX) -- Length (1023*max_identifierLength)+(15*2)+(16*3) is > 4000
3580+ );
3581+ INSERT INTO # sp_helpindex (index_name, index_description, index_keys)
35733582 EXEC sys .sp_helpindex @ObjectName;
3583+
3584+ IF EXISTS (SELECT 1 FROM # sp_helpindex)
3585+ BEGIN
3586+ SET @SQLString = N'
3587+ WITH includedColumns AS (
3588+ SELECT DISTINCT i2.name AS index_name
3589+ , LTRIM(STUFF((
3590+ SELECT ' ' , ' ' + c.name
3591+ FROM sys.indexes i
3592+ INNER JOIN ' + QUOTENAME(DB_NAME()) + ' .sys.index_columns ic ON i.index_id = ic.index_id
3593+ INNER JOIN ' + QUOTENAME(DB_NAME()) + ' .sys.columns c ON c.column_id = ic.column_id
3594+ WHERE i.object_id = @ObjID
3595+ AND ic.object_id = @ObjID
3596+ AND c.object_id = @ObjID
3597+ AND ic.is_included_column = 1
3598+ AND i2.index_id = i.index_id
3599+ FOR XML PATH(' ' ' ' ), TYPE).value(' ' .' ' , ' ' NVARCHAR(MAX)' ' ), 1, 1, ' ' ' ' )) AS included
3600+ FROM ' + QUOTENAME(DB_NAME()) + ' .sys.indexes i2
3601+ INNER JOIN #sp_helpindex sp ON sp.index_name COLLATE database_default = i2.name
3602+ INNER JOIN ' + QUOTENAME(DB_NAME()) + ' .sys.index_columns ic ON i2.index_id = ic.index_id
3603+ WHERE i2.object_id = @ObjID
3604+ AND ic.object_id = @ObjID
3605+ AND ic.is_included_column = 1
3606+ )
3607+ UPDATE sp
3608+ SET sp.index_includes = ic.included
3609+ FROM #sp_helpindex sp
3610+ INNER JOIN includedColumns ic ON sp.index_name COLLATE database_default = ic.index_name;' ;
3611+ SET @ParmDefinition = N' @ObjID INT' ;
3612+
3613+ EXEC sp_executesql @SQLString
3614+ ,@ParmDefinition
3615+ ,@ObjID;
3616+ END
3617+
3618+ IF EXISTS (SELECT 1 FROM # sp_helpindex)
3619+ BEGIN
3620+ SELECT index_name, index_description, index_keys, index_includes
3621+ FROM # sp_helpindex;
3622+ END
3623+ /* End custom included columns for sp_helpindex */
3624+
35743625 EXEC sys .sp_helpconstraint @ObjectName,' nomsg' ;
35753626
35763627 SET @SQLString = N' SELECT @HasDepen = COUNT(1)
@@ -3753,7 +3804,7 @@ Version: 20220818
37533804
37543805MIT License
37553806
3756- Copyright (c) 2022 John McCall
3807+ Copyright (c) 2023 John McCall
37573808
37583809Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
37593810documentation files (the "Software"), to deal in the Software without restriction, including without limitation
0 commit comments