I would like to know if there is any way to know the owner of an object in SQL SERVER
I would like to know if there is any way to know the owner of an object in SQL SERVER
You can use the view / table sysobjects
that is available from SQL 2000
SELECT so.name AS 'ObjectName',
su.name AS 'OwnerName'
FROM sysobjects so
INNER JOIN sysusers su
ON so.uid = su.uid
ORDER BY 2,1
This will give you the owners
of each of the different objects in the current database, you could eventually filter by so.id
if you have the OBJECT_ID of the object or so.name
if you have the name, always check the so.xtype
to be sure of the type of object.
Note : sysobjects
is a view that is maintained for compatibility, the correct thing in new versions would be to use sys.sysobjects