SQL Server Performance

How to translate a ORIGINAL_LOGIN() to its database user name?

Discussion in 'SQL Server 2005 General DBA Questions' started by Jelly0228, May 24, 2010.

  1. Jelly0228 New Member

    My Original_login() is a windows account.
    use [master]
    select orginal_login()
    select user_name()
    But following code returns nothing in MASTER database:
    SELECT a.name,b.name AS Login_Mapped_to_DBO
    FROM sys.database_principals a
    INNER JOIN sys.server_principals b
    ON a.sid = b.sid
    But it can return a row when I run it in a user-created database:
    Return: dbo TFHGFHG-2005C97Administrator
    How can I translate a original_login() to a db user name?
    Thanks for any help.
  2. FrankKalis Moderator

    Hi, have you found an answer yet?
  3. Madhivanan Moderator

    Which version of SQL Server are you using?
    There is no such function called orginal_login()
    See who owns master dbsp_helpdb
  4. satya Moderator

  5. Madhivanan Moderator

  6. satya Moderator

    Even I was thinking for a second that there isn't such function in SQL, but our good old friend BOL gave me a kick to learn about this option.... learn new things everyday [:)].

Share This Page