Last active
February 13, 2017 22:10
-
-
Save nullbind/c58e424d81f96efb3a2a360238021716 to your computer and use it in GitHub Desktop.
This script with enumerate all database users for the selected database. The SQL login must have a database user mapping or guest access. No other privileges are required.
This file contains 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
select n [id], USER_NAME(n) [user_name] | |
from ( | |
select top 10000 row_number() over(order by t1.number) as N | |
from master..spt_values t1 | |
cross join master..spt_values t2 | |
) a | |
where USER_NAME(n) is not null | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment