Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Posts
    52

    Unanswered: 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 you

  2. #2
    Join Date
    Feb 2004
    Posts
    492
    This might help:

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

    or take a look at sysobjects and sysusers.

  3. #3
    Join Date
    Feb 2004
    Location
    San Antonio, TX
    Posts
    565
    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

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    select user_name(objectproperty(id, 'OwnerID')) + '.' + name
    from sysobjects
    order by objectproperty(id, 'OwnerID'), name
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  5. #5
    Join Date
    Feb 2004
    Location
    San Antonio, TX
    Posts
    565
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •