Skip to content

Add optional database execution order to sp_ineachdb. - #4034

Merged
BrentOzar merged 1 commit into
BrentOzarULTD:devfrom
jbelina:sp-ineachdb-database-execution-order
Jul 16, 2026
Merged

Add optional database execution order to sp_ineachdb.#4034
BrentOzar merged 1 commit into
BrentOzarULTD:devfrom
jbelina:sp-ineachdb-database-execution-order

Conversation

@jbelina

@jbelina jbelina commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

I had fun with other sort options, but RANDOM and EMAN didn't seem practical.

ORDER BY
          CASE @database_order
          WHEN N'NAME' THEN name
          WHEN N'RANDOM' THEN TRY_CAST(NEWID() AS NVARCHAR(36)) -- Just for fun #1 Random order
          WHEN N'EMAN' THEN REVERSE(name) -- Just for fun #2 EMAN (NAME backwards)
          ELSE NULL END ASC
          , id ASC;

#4033

    I had fun with other sort options, but RANDOM and EMAN didn't seem practical.

         ```ORDER BY
          CASE @database_order
          WHEN N'NAME' THEN name
          WHEN N'RANDOM' THEN TRY_CAST(NEWID() AS NVARCHAR(36)) -- Just for fun BrentOzarULTD#1 Random order
          WHEN N'EMAN' THEN REVERSE(name) -- Just for fun BrentOzarULTD#2 EMAN (NAME backwards)
          ELSE NULL END ASC
          , id ASC;```

BrentOzarULTD#4033
@BrentOzar BrentOzar added this to the 2026-09 Release milestone Jul 16, 2026

@BrentOzar BrentOzar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request! Makes sense, looks good, merging into dev, will be in the next release with credit to you in the release notes.

@BrentOzar
BrentOzar merged commit 8229607 into BrentOzarULTD:dev Jul 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants