Script for aliases

  • I need a script to display all logins that are aliased to dbo user. Not in the dbowner role but aliased to the dbo. Any ideas?

  • I don't know how to get the info specifically for dbo, but if you run sp_helpuser with no parameters in a database, it will display the logins aliased to users.

    Greg

    Greg

  • Thanks. I used that but it not quite what I am after. Maybe I can disect the Sp_helpuser SP and get what I am after out of it.

  • i looked at sp_addalias, and it looks like any users that are aliased as dbo would have the sid for sa/dbo (which is always 1):

        -- INSERT SYSUSERS ROW --

        insert into sysusers select

            @newuid, @status | 16, @loginame, @sid, 0x00,

                    getdate(), getdate(), @targuid, NULL

    select * from sysusers where sid=0x01

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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