June 19, 2017 at 9:21 am
Hi all,
My Google skills seem to have failed me here!!
Any ideas?
Thanks,
JB
June 19, 2017 at 9:26 am
Join sys.database_principals to sys.server_principals on sid=sid.
John
June 19, 2017 at 10:14 am
John Mitchell-245523 - Monday, June 19, 2017 9:26 AMJoin sys.database_principals to sys.server_principals on sid=sid.John
Pretty close, this did it for me....
Use YourDatabaseNameHere
Go
Select S.name
From sys.database_principals As DB
Join sys.server_principals As S
on DB.sid = S.sid
Where default_schema_name = 'dbo'
June 20, 2017 at 2:46 am
Thom A - Monday, June 19, 2017 10:36 AMJust to point to put, that isn't exactly what you asked. That query returns a list of logins that have their default Schema set to dbo on the current database.
Good point, that's what I should have asked for. I'm working to improve some unclear documentation created by an Oracle DBA, which states a login to a Test DB should be remapped (post refresh) to dbo, so I'm looking at correct result and then working backwards to see what the docu should be stating.
June 20, 2017 at 2:55 am
JaybeeSQL - Tuesday, June 20, 2017 2:46 AMThom A - Monday, June 19, 2017 10:36 AMJust to point to put, that isn't exactly what you asked. That query returns a list of logins that have their default Schema set to dbo on the current database.Good point, that's what I should have asked for. I'm working to improve some unclear documentation created by an Oracle DBA, which states a login to a Test DB should be remapped (post refresh) to dbo, so I'm looking at correct result and then working backwards to see what the docu should be stating.
It's still not the default_schema_name column you need. It's name. But please, this sounds like an awfully bad idea. If you map a login to dbo in a database, that login becomes the owner of that database, and can make any changes to the database, including dropping it. That probably isn't what you want. Have some harmless login(s) that nobody knows the password to own your databases, and to the logins that are actually used for stuff, assign them only the permissions they need.
John
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply