Add optional database execution order to sp_ineachdb. - #4034
Merged
BrentOzar merged 1 commit intoJul 16, 2026
Conversation
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
approved these changes
Jul 16, 2026
BrentOzar
left a comment
Member
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I had fun with other sort options, but RANDOM and EMAN didn't seem practical.
#4033