May 28, 2010 at 11:07 am
Hello,
I would really appreciate if I can get the easy way to pull the list of all the sql and AD accounts in SQL (at database level, I need to run this for my audit purposes,
Thanks in Advance,
Dev
May 28, 2010 at 12:16 pm
Were you just looking for something simple like this?
use [DatabaseName]
Go
select name from sysusers
where islogin = 1
May 29, 2010 at 3:17 am
you may want to try posting in the correct forum in future 😉
The database table you need to query is sys.database_principals, this script should help!
use yourdb
select 'Login name : ' + name +
', SID : ' + sys.fn_varbintohexstr(sid) +
', Type : ' + type_desc +
', Default Schema : ' + default_schema_name +
', Created Date : ' + cast(create_date as varchar(20)) +
', Modified : ' + cast(modify_date as varchar(20))
from sys.database_principals
--anything not a database role or default account (e.g. sys, dbo, etc)
where is_fixed_role <> 1 and principal_id > 4
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
May 31, 2010 at 9:07 am
Hello,
I need a statement which I could run once and it would genertate the information for all the users existing in SQL with the type of permissions,
Much Appreciated,
Thanks,
Dev
April 27, 2012 at 1:50 pm
Hello,
I need a statement which I could run once and it would genertate the information for all the users existing in SQL with the type of permissions,
Much Appreciated,
Thanks,
Dev
April 28, 2012 at 7:31 am
dsohal (4/27/2012)
Hello,I need a statement which I could run once and it would genertate the information for all the users existing in SQL with the type of permissions,
Much Appreciated,
Thanks,
Dev
First of all, it’s nice to see another ‘Dev’ in SSC.
Second, why did you come back to old thread after a year? Shouldn’t it be a new thread?
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply