5
(1)

Below query can be used to get all the logins having sa role in Sybase database.

select @@servername,l.name,l.fullname,u.name from syslogins as l,sysroles as r,sysloginroles as sr,sysusers as u where l.suid=sr.suid and u.uid=r.lrid and r.id=sr.srid and srid = 0

Sample output:

Alternate query:

Below query can also be used to get sa role details in Sybase database.

select @@servername 'Server_Name',sl.name 'LoginID',fullname 'Full_Name', ssr.name 'Role_Type'
from syslogins sl
join sysloginroles slr
on slr.suid = sl.suid
join syssrvroles ssr
on ssr.srid = slr.srid
where ssr.name='sa_role'

Sample output:

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.