Delete a Security Login

  • Hello,

    I need to delete a security  login from a single instance of SQL Server 2000. When I try to delete the login I receive a message that says something like "cannot delete this login because it owns objects." I know this user created, and is the owner of, a couple of tables and one DTS Package. I have two questions:

    1. Is there a way to find out all of the objects per an owner?

    2. How do I change the owner of an object and to what? Do I use SS2000 SP's and use dbo as the owner?

    Thanks,

    Steve

  • one way is,

    loop thru all your databases in the instance

    run this:

    select 'sp_changeobjectowner "' + su.name + '.' + so.name + '",' + 'dbo'

    from sysobjects so, sysusers su

    where so.uid = su.uid

    and su.name = 'username' --username you want to remove

     

     

  • Thanks ND. Your solution worked just fine.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply