Monday 11 April 2011

ASE : Show Users / Logins with Access to the Database

This handy procedure will display users in the current database .. in
addition to aliases defined.

create proc sp_users as

select 'user:' 'Type', t1.suid, t1.name 'dbuser', t2.name
from sysusers t1, master..syslogins t2
where t2.suid=*t1.suid
union
select 'alias:' 'Type', t1.suid, ' ' 'dbuser', t2.name
from sysalternates t1, master..syslogins t2
where t2.suid=*t1.suid
order by 2

return

No comments:

Post a Comment