File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ ALTER PROCEDURE dbo.sp_BlitzWho
2222 @CheckDateOverride DATETIMEOFFSET = NULL ,
2323 @Version VARCHAR (30 ) = NULL OUTPUT ,
2424 @VersionDate DATETIME = NULL OUTPUT ,
25- @VersionCheckMode BIT = 0
25+ @VersionCheckMode BIT = 0 ,
26+ @SortOrder NVARCHAR (256 ) = ' elapsed_time'
2627AS
2728BEGIN
2829 SET NOCOUNT ON ;
@@ -1030,9 +1031,12 @@ IF (@MinElapsedSeconds + @MinCPUTime + @MinLogicalReads + @MinPhysicalReads + @M
10301031 SET @StringToExecute + = N ' ) ' ;
10311032 END
10321033
1033- SET @StringToExecute + =
1034- N' ORDER BY 2 DESC
1035- ' ;
1034+ SET @StringToExecute + =
1035+ N ' ORDER BY ' + CASE WHEN @SortOrder = ' elapsed_time' THEN ' [elapsed_time] ASC'
1036+ WHEN @SortOrder = ' session_id' THEN ' [session_id] DESC'
1037+ ELSE ' [elapsed_time] ASC'
1038+ END + '
1039+ ' ;
10361040
10371041
10381042IF @OutputDatabaseName IS NOT NULL AND @OutputSchemaName IS NOT NULL AND @OutputTableName IS NOT NULL
You can’t perform that action at this time.
0 commit comments