Skip to content

Commit 80a0834

Browse files
authored
Merge pull request #2862 from BrentOzarULTD/2842_sp_BlitzWho_new_params_to_table
#2842 sp_BlitzWho params to table
2 parents aa43ba9 + f096917 commit 80a0834

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

sp_BlitzWho.sql

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,20 @@ IF @OutputDatabaseName IS NOT NULL AND @OutputSchemaName IS NOT NULL AND @Output
262262
ALTER TABLE ' + @ObjectFullName + N' ADD JoinKey AS ServerName + CAST(CheckDate AS NVARCHAR(50));';
263263
EXEC(@StringToExecute);
264264

265+
/* If the table doesn't have the new cached_parameter_info computed column, add it. See Github #2842. */
266+
SET @ObjectFullName = @OutputDatabaseName + N'.' + @OutputSchemaName + N'.' + @OutputTableName;
267+
SET @StringToExecute = N'IF NOT EXISTS (SELECT * FROM ' + @OutputDatabaseName + N'.sys.all_columns
268+
WHERE object_id = (OBJECT_ID(''' + @ObjectFullName + N''')) AND name = ''cached_parameter_info'')
269+
ALTER TABLE ' + @ObjectFullName + N' ADD cached_parameter_info NVARCHAR(MAX) NULL;';
270+
EXEC(@StringToExecute);
271+
272+
/* If the table doesn't have the new live_parameter_info computed column, add it. See Github #2842. */
273+
SET @ObjectFullName = @OutputDatabaseName + N'.' + @OutputSchemaName + N'.' + @OutputTableName;
274+
SET @StringToExecute = N'IF NOT EXISTS (SELECT * FROM ' + @OutputDatabaseName + N'.sys.all_columns
275+
WHERE object_id = (OBJECT_ID(''' + @ObjectFullName + N''')) AND name = ''live_parameter_info'')
276+
ALTER TABLE ' + @ObjectFullName + N' ADD live_parameter_info NVARCHAR(MAX) NULL;';
277+
EXEC(@StringToExecute);
278+
265279
/* Delete history older than @OutputTableRetentionDays */
266280
SET @OutputTableCleanupDate = CAST( (DATEADD(DAY, -1 * @OutputTableRetentionDays, GETDATE() ) ) AS DATE);
267281
SET @StringToExecute = N' IF EXISTS(SELECT * FROM '

0 commit comments

Comments
 (0)