Monday, March 19, 2012

HELP! How to find the owner of an object?

I need to remove some login ID on a SQL2000 server, but it did not let me
because the login ID owns objects in one or more databases.
How can I find out what objects does the login ID own?
Thank youThis might help:

select * from information_schema.tables where table_schema <> 'dbo'

or take a look at sysobjects and sysusers.|||use northwind go
SELECT
so.name AS 'ObjectName'
,su.name AS 'OwnerName'
FROM sysobjects so
JOIN
sysusers su
ON so.uid = su.uid
WHERE xtype <> 's'
ORDER BY 2

by the way. SQL Formatting brought to you by SQLInForm.com|||select user_name(objectproperty(id, 'OwnerID')) + '.' + name
from sysobjects
order by objectproperty(id, 'OwnerID'), name|||you just couldnt leave well enough alone, huh?
and after i quote you all the time.

Scott Davis
"If you are not part of the solution, you are probably 1/5th of a suspension" RDjabarov

No comments:

Post a Comment