actual creator of a database
-
Tuesday, September 11, 2007 3:26 PM
Does anyone know how to obain the actual creator of a database by using TSQL or SP? I need to know actual Login not DBO.
Thanks.
All Replies
-
Tuesday, September 11, 2007 3:54 PMModerator
You can access the system table directly:
select suser_sname(sid)
from master..sysdatabases
where name = 'tempdb'There maybe an inbuilt T-SQL function that would tell you this, which would be a preferable way of getting the info.
HTH! -
Tuesday, September 11, 2007 4:00 PMModerator
You cannot do this (exactly) that I know of. You can get the owner of the database using the code in the other post:
select suser_sname(sid)
from master..sysdatabases
where name = 'tempdb'or
select name, suser_sname(owner_sid)
from
sys.databasesThe owner can be changed though using: sp_changedbowner, so you are actually getting the current owner. That may be good enough for your needs, but it is a caveat you should understand.

