@@ -169,7 +169,7 @@ BEGIN
169169 ,@Msg NVARCHAR(MAX) = N' '
170170 ,@DbName SYSNAME = N' '
171171 ,@TempCheckSQL NVARCHAR(MAX) = N' '
172- ,@BaseURL VARCHAR (1000 ) = ' http://dba-multitool.org/blob/master/docs/sp_sizeoptimiser.md ' ;
172+ ,@BaseURL VARCHAR (1000 ) = ' http://dba-multitool.org/' ;
173173
174174 /* Validate @IndexNumThreshold */
175175 IF (@IndexNumThreshold < 1 OR @IndexNumThreshold > 999 )
@@ -388,7 +388,7 @@ BEGIN
388388 ,QUOTENAME(SCHEMA_NAME([t].[schema_id])) + ' ' .' ' + QUOTENAME([t].[name])
389389 ,QUOTENAME([c].[name])
390390 ,N' ' Columns storing date or time should use a temporal specific data type, but this column is using ' ' + ty.name + ' ' .' '
391- ,CONCAT(@BaseURL COLLATE database_default, ' ' # time-based-formats' ' )
391+ ,CONCAT(@BaseURL COLLATE database_default, ' ' time-based-formats' ' )
392392 FROM [sys].[columns] AS [c]
393393 INNER JOIN [sys].[tables] AS [t] on [t].[object_id] = [c].[object_id]
394394 INNER JOIN [sys].[types] AS [ty] on [ty].[user_type_id] = [c].[user_type_id]
@@ -416,7 +416,7 @@ BEGIN
416416 SELECT QUOTENAME(SCHEMA_NAME(t.schema_id)) + ' ' .' ' + QUOTENAME(t.name) AS [obj_name]
417417 ,QUOTENAME(c.name) AS [col_name]
418418 ,N' ' Possible arbitrary variable length column in use. Is the ' ' + ty.name + N' ' length of ' ' + CAST (c.max_length / 2 AS varchar(MAX)) + N' ' based on requirements?' ' AS [message]
419- ,CONCAT(@BaseURL COLLATE database_default, ' ' # arbitrary-varchar-length' ' ) AS [ref_link]
419+ ,CONCAT(@BaseURL COLLATE database_default, ' ' arbitrary-varchar-length' ' ) AS [ref_link]
420420 FROM sys.columns c
421421 INNER JOIN sys.tables as t on t.object_id = c.object_id
422422 INNER JOIN sys.types as ty on ty.user_type_id = c.user_type_id
@@ -428,7 +428,7 @@ BEGIN
428428 SELECT QUOTENAME(SCHEMA_NAME(t.schema_id)) + ' ' .' ' + QUOTENAME(t.name)
429429 ,QUOTENAME(c.name)
430430 ,N' ' Possible arbitrary variable length column in use. Is the ' ' + ty.name + N' ' length of ' ' + CAST (c.max_length AS varchar(MAX)) + N' ' based on requirements' '
431- ,CONCAT(@BaseURL COLLATE database_default, ' ' # arbitrary-varchar-length' ' )
431+ ,CONCAT(@BaseURL COLLATE database_default, ' ' arbitrary-varchar-length' ' )
432432 FROM sys.columns as c
433433 INNER JOIN sys.tables as t on t.object_id = c.object_id
434434 INNER JOIN sys.types as ty on ty.user_type_id = c.user_type_id
@@ -466,7 +466,7 @@ BEGIN
466466 SELECT QUOTENAME(SCHEMA_NAME(t.schema_id)) + ' ' .' ' + QUOTENAME(t.name) AS [obj_name]
467467 ,QUOTENAME(c.name) AS [col_name]
468468 ,N' ' VARCHAR column without specified length, it should not have a length of ' ' + CAST (c.max_length AS varchar(10)) + ' ' ' ' AS [message]
469- ,CONCAT(@BaseURL COLLATE database_default, ' ' # unspecified-varchar-length' ' ) AS [ref_link]
469+ ,CONCAT(@BaseURL COLLATE database_default, ' ' unspecified-varchar-length' ' ) AS [ref_link]
470470 FROM sys.columns as c
471471 INNER JOIN sys.tables as t on t.object_id = c.object_id
472472 INNER JOIN sys.types as ty on ty.user_type_id = c.user_type_id
@@ -508,7 +508,7 @@ BEGIN
508508 ,QUOTENAME(SCHEMA_NAME(t.schema_id)) + ' ' .' ' + QUOTENAME(t.name)
509509 ,QUOTENAME(c.name)
510510 ,N' ' Column is NVARCHAR(MAX) which allows very large row sizes. Consider a character limit.' '
511- ,CONCAT(@BaseURL COLLATE database_default, ' ' # mad-varchar-max' ' )
511+ ,CONCAT(@BaseURL COLLATE database_default, ' ' mad-varchar-max' ' )
512512 FROM sys.columns as c
513513 INNER JOIN sys.tables as t on t.object_id = c.object_id
514514 INNER JOIN sys.types as ty on ty.user_type_id = c.user_type_id
@@ -540,7 +540,7 @@ BEGIN
540540 ,QUOTENAME(SCHEMA_NAME([o].schema_id)) + ' ' .' ' + QUOTENAME(OBJECT_NAME([o].object_id))
541541 ,QUOTENAME([ac].[name])
542542 ,N' ' nvarchar columns take 2x the space per char of varchar. Only use if you need Unicode characters.' '
543- ,CONCAT(@BaseURL COLLATE database_default, ' ' # nvarchar-in-express' ' )
543+ ,CONCAT(@BaseURL COLLATE database_default, ' ' nvarchar-in-express' ' )
544544 FROM [sys].[all_columns] AS [ac]
545545 INNER JOIN [sys].[types] AS [t] ON [t].[user_type_id] = [ac].[user_type_id]
546546 INNER JOIN [sys].[objects] AS [o] ON [o].object_id = [ac].object_id
@@ -574,7 +574,7 @@ BEGIN
574574 ,QUOTENAME(SCHEMA_NAME([o].[schema_id])) + ' ' .' ' + QUOTENAME([o].[name])
575575 ,QUOTENAME([ac].[name])
576576 ,N' ' Best practice is to use DECIMAL/NUMERIC instead of ' ' + UPPER([st].[name]) + ' ' for non floating point math.' '
577- ,CONCAT(@BaseURL COLLATE database_default, ' ' # float-and-real-data-types' ' )
577+ ,CONCAT(@BaseURL COLLATE database_default, ' ' float-and-real-data-types' ' )
578578 FROM [sys].[all_columns] AS [ac]
579579 INNER JOIN [sys].[objects] AS [o] ON [o].[object_id] = [ac].[object_id]
580580 INNER JOIN [sys].[systypes] AS [st] ON [st].[xtype] = [ac].[system_type_id]
@@ -603,7 +603,7 @@ BEGIN
603603 ,QUOTENAME(SCHEMA_NAME(o.schema_id)) + ' ' .' ' + QUOTENAME(o.name)
604604 ,QUOTENAME(ac.name)
605605 ,N' ' Deprecated data type in use: ' ' + st.name + ' ' .' '
606- ,CONCAT(@BaseURL COLLATE database_default, ' ' # deprecated-data-types' ' )
606+ ,CONCAT(@BaseURL COLLATE database_default, ' ' deprecated-data-types' ' )
607607 FROM sys.all_columns AS ac
608608 INNER JOIN sys.objects AS o ON o.object_id = ac.object_id
609609 INNER JOIN sys.systypes AS st ON st.xtype = ac.system_type_id
@@ -634,7 +634,7 @@ BEGIN
634634 ,QUOTENAME(SCHEMA_NAME(t.schema_id)) + ' ' .' ' + QUOTENAME(t.name)
635635 ,QUOTENAME(c.name)
636636 ,N' ' BIGINT used on IDENTITY column in SQL Express. If values will never exceed 2,147,483,647 use INT instead.' '
637- ,CONCAT(@BaseURL COLLATE database_default, ' ' # bigint-as-identity' ' )
637+ ,CONCAT(@BaseURL COLLATE database_default, ' ' bigint-as-identity' ' )
638638 FROM sys.columns as c
639639 INNER JOIN sys.tables as t on t.object_id = c.object_id
640640 INNER JOIN sys.types as ty on ty.user_type_id = c.user_type_id
@@ -670,7 +670,7 @@ BEGIN
670670 ,QUOTENAME(ac.name)
671671 ,N' ' Column is ' ' + UPPER(st.name) + ' ' (' ' + CAST(ac.precision AS VARCHAR) + ' ' ,' ' + CAST(ac.scale AS VARCHAR) + ' ' )' '
672672 + ' ' . Consider using an INT variety for space reduction since the scale is 0.' '
673- ,CONCAT(@BaseURL COLLATE database_default, ' ' # numeric-or-decimal-0-scale' ' )
673+ ,CONCAT(@BaseURL COLLATE database_default, ' ' numeric-or-decimal-0-scale' ' )
674674 FROM sys.objects AS o
675675 INNER JOIN sys.all_columns AS ac ON ac.object_id = o.object_id
676676 INNER JOIN sys.systypes AS st ON st.xtype = ac.system_type_id
@@ -701,7 +701,7 @@ BEGIN
701701 ,QUOTENAME(SCHEMA_NAME(o.schema_id)) + ' ' .' ' + QUOTENAME(o.name)
702702 ,QUOTENAME(ac.name)
703703 ,N' ' Column is potentially an enum that should be a foreign key to a normalized table for data integrity, space savings, and performance.' '
704- ,CONCAT(@BaseURL COLLATE database_default, ' ' # enum-column-not-implemented-as-foreign-key' ' )
704+ ,CONCAT(@BaseURL COLLATE database_default, ' ' enum-column-not-implemented-as-foreign-key' ' )
705705 FROM sys.objects AS o
706706 INNER JOIN sys.all_columns AS ac ON ac.object_id = o.object_id
707707 INNER JOIN sys.systypes AS st ON st.xtype = ac.system_type_id
@@ -740,7 +740,7 @@ BEGIN
740740 WHEN max_size > 0
741741 THEN CAST((max_size / 1024) * 8 AS VARCHAR(MAX))
742742 END + ' ' , which is over the user database maximum file size of 10GB.' '
743- ,CONCAT(@BaseURL COLLATE database_default, ' ' # database-growth-past-10GB' ' )
743+ ,CONCAT(@BaseURL COLLATE database_default, ' ' database-growth-past-10GB' ' )
744744 FROM sys.master_files mf
745745 WHERE (max_size > 1280000 OR max_size = -1) -- greater than 10GB or unlimited
746746 AND [mf].[database_id] > 5
@@ -772,7 +772,7 @@ BEGIN
772772 ,[mf].[name]
773773 ,NULL
774774 ,N' Database file ' + [mf].[name]+ ' has growth set to % instead of a fixed amount. This may grow quickly.'
775- ,CONCAT(@BaseURL, ' # database-growth-type' )
775+ ,CONCAT(@BaseURL, ' database-growth-type' )
776776 FROM [sys].[master_files] AS [mf]
777777 INNER JOIN [sys].[databases] AS [sd] ON [sd].[database_id] = [mf].[database_id]
778778 INNER JOIN # Databases AS [d] ON [d].[database_name] = [sd].[name]
@@ -802,7 +802,7 @@ BEGIN
802802 ,QUOTENAME(SCHEMA_NAME([o].[schema_id])) + ' ' .' ' + QUOTENAME([o].[name]) + ' ' .' ' + QUOTENAME([i].[name])
803803 ,NULL
804804 ,N' ' Non-default fill factor on this index. Not inherently bad, but will increase table size more quickly.' '
805- ,CONCAT(@BaseURL COLLATE database_default, ' ' # default-fill-factor' ' )
805+ ,CONCAT(@BaseURL COLLATE database_default, ' ' default-fill-factor' ' )
806806 FROM [sys].[indexes] AS [i]
807807 INNER JOIN [sys].[objects] AS [o] ON [o].[object_id] = [i].[object_id]
808808 WHERE [i].[fill_factor] NOT IN(0, 100);'
@@ -834,7 +834,7 @@ BEGIN
834834 ,QUOTENAME(SCHEMA_NAME(t.schema_id)) + ' ' .' ' + QUOTENAME(t.name)
835835 ,NULL
836836 ,' ' There are ' ' + CAST(COUNT(DISTINCT(i.index_id)) AS VARCHAR) + ' ' indexes on this table taking up ' ' + CAST(CAST(SUM(s.[used_page_count]) * 8 / 1024.00 AS DECIMAL(10, 2)) AS VARCHAR) + ' ' MB of space.' '
837- ,CONCAT(@BaseURL COLLATE database_default, ' ' #default-fill-factor ' ' )
837+ ,CONCAT(@BaseURL COLLATE database_default, ' ' number-of-indexes ' ' )
838838 FROM sys.indexes AS i
839839 INNER JOIN sys.tables AS t ON i.object_id = t.object_id
840840 INNER JOIN sys.dm_db_partition_stats AS s ON s.object_id = i.object_id
@@ -1003,7 +1003,7 @@ BEGIN
10031003 ,[obj_name]
10041004 ,[col_name]
10051005 ,[message]
1006- ,CONCAT(@BaseURL,' # inefficient-indexes' )
1006+ ,CONCAT(@BaseURL,' inefficient-indexes' )
10071007 FROM # DuplicateIndex;
10081008
10091009 /* Overlapping Indexes */
@@ -1015,7 +1015,7 @@ BEGIN
10151015 ,[obj_name]
10161016 ,[col_name]
10171017 ,[message]
1018- ,CONCAT(@BaseURL,' # inefficient-indexes' )
1018+ ,CONCAT(@BaseURL,' inefficient-indexes' )
10191019 FROM # OverlappingIndex;
10201020
10211021 END; -- Inefficient indexes check
@@ -1273,7 +1273,7 @@ BEGIN
12731273 ,QUOTENAME([schema_name]) + ' .' + QUOTENAME([table_name])
12741274 ,QUOTENAME([col_name])
12751275 ,N' Candidate for converting to a space-saving sparse column based on NULL distribution of more than ' + CAST([threshold_null_perc] AS VARCHAR (3 ))+ ' percent.'
1276- ,CONCAT(@BaseURL, ' # sparse-columns' )
1276+ ,CONCAT(@BaseURL, ' sparse-columns' )
12771277 FROM # Stats
12781278 WHERE [null_perc] >= [threshold_null_perc];
12791279 END; -- Sparse column check
@@ -1297,7 +1297,7 @@ BEGIN
12971297 ,QUOTENAME(SCHEMA_NAME([t].[schema_id])) + ' ' .' ' + QUOTENAME([t].[name])
12981298 ,NULL
12991299 ,N' ' Heap tables can result in massive fragmentation and have additional indexing overhead.' '
1300- ,CONCAT(@BaseURL COLLATE database_default, ' ' # heap-tables' ' )
1300+ ,CONCAT(@BaseURL COLLATE database_default, ' ' heap-tables' ' )
13011301 FROM [sys].[tables] AS [t]
13021302 INNER JOIN [sys].[indexes] AS [i] ON [i].[object_id] = [t].[object_id]
13031303 WHERE [i].[type] = 0'
0 commit comments