![]() ![]() ![]() ![]() I use the following batch to list all logins of all databases including their owners. LEFT OUTER JOIN sys.database_permissions AS dp ON dp.grantee_principal_id = u.principal_id and dp.type = 'CO' SELECTĪS sysname),'''') + ']' + + quotename(db_name(),'''') + ']' + + quotename(u.name,'''') + ']' AS ,ĬAST(CASE dp.state WHEN N'G' THEN 1 WHEN 'W' THEN 1 ELSE 0 END AS bit) AS And this query is something that somebody at Microsoft has written (you know, the peeps who know the product inside and out, aka, the experts), so they are familiar with all the weird "flags" in the database.īut the SSMS/GUI -> Sql Profiler tricks works in many scenarios. I got the below when I was in MyDatabase / Security / Users and clicked "refresh" on the "Users".Īgain, I didn't come up with the WHERE clause and the LEFT OUTER JOIN, it was a part of the SSMS query. Then right click in the GUI (in SSMS) and click "Refresh". Whenever you 'see' something in the GUI (SSMS) and you're like "that's what I need", you can always run Sql Profiler to fish for the query that was used. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |