Skip to content

Commit

Permalink
Added more checks for database_id with the new tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
ReeceGoding committed Jul 27, 2024
1 parent c4f6cf8 commit ff8273c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sp_QuickieStore/sp_QuickieStore.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5071,14 +5071,16 @@ CROSS APPLY
SELECT
@sql += N'
JOIN #plan_ids_with_query_hashes AS hashes
ON qsrs.plan_id = hashes.plan_id'
ON qsrs.plan_id = hashes.plan_id
AND hashes.database_id = @database_id'
END;
IF @sort_order_is_a_wait = 1
BEGIN
SELECT
@sql += N'
JOIN #plan_ids_with_total_waits AS waits
ON qsrs.plan_id = waits.plan_id'
ON qsrs.plan_id = waits.plan_id
AND waits.database_id = @database_id'
END;

SELECT
Expand Down Expand Up @@ -7513,14 +7515,16 @@ FROM
SELECT
@sql += N'
JOIN #plan_ids_with_query_hashes AS hashes
ON qsrs.plan_id = hashes.plan_id'
ON qsrs.plan_id = hashes.plan_id
AND hashes.database_id = @database_id'
END;
IF @sort_order_is_a_wait = 1
BEGIN
SELECT
@sql += N'
JOIN #plan_ids_with_total_waits AS waits
ON qsrs.plan_id = waits.plan_id'
ON qsrs.plan_id = waits.plan_id
AND waits.database_id = @database_id'
END;

SELECT
Expand Down

0 comments on commit ff8273c

Please sign in to comment.