So, are you saying that whether I use SMO or not, eventually a SQL SELECT will be performed?\
I posted a similar question in the EF forums on the MSDN Entity Framework forum and someone there recommended that I use the following SELECT:
p.name AS [Name] ,r.type_desc
INNER JOIN sys.server_role_members m ON r.principal_id = m.role_principal_id
INNER JOIN sys.server_principals p ON
p.principal_id = m.member_principal_id
WHERE r.type = 'R' and r.name = N'sysadmin'
I've been experimenting with the code and it doesn't seem to give me what I'd hope for. In fact, running the above code exactly as it is given, returns only 1 record:
I'm not familiar with any of those views (which is what I think they are) so I'm just poking around trying to figure them out.
Connect with me on LinkedIn