Just have a question on T-SQL for finding all databases owner by a certain user. I can just get that information via user mappings but I really want to expand my query knowledge so here goes.
So far I have managed to piece together a query that shows me the users on all databases
[B]SELECT SUSER_SNAME(owner_sid) from sys.databases[/B]
How do I get it to show me the Databases link with a single account?
Any help would be great!
edit:
[B]SELECT DB_NAME(database_id) from sys.databases[/B]
Gives me DB names
[B]SELECT DB_NAME(database_id)AS dbname FROM sys.databases
WHERE SUSER_SNAME(owner_sid) IN (SELECT SUSER_SNAME(owner_sid)AS dbuser FROM sys.databases) [/B]
That doesn't work