Last active
April 17, 2019 17:14
-
-
Save ghotz/9c081e10ee2bc50cb2f82997a902bc73 to your computer and use it in GitHub Desktop.
Get all users with a non standard default schema for all databases
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
EXEC sp_MSforeachdb ' | |
USE [?]; | |
SELECT DB_NAME() AS database_name, name AS principal_name, default_schema_name | |
FROM sys.database_principals | |
WHERE default_schema_name NOT IN (''dbo'', ''guest''); | |
'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment