sql server userid and password are stored in which db.

  • hi to all,

    where does the loginid and password are stored ?

    how can i access them by writting code.?

  • They're in master.

    You can get usernames from sys.server_principals, you can get the hashed passwords from sys.sql_logins (I think) but there's no way to get the plaintext passwords. SQL doesn't store the passwords as plaintext, only the hashed form.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • You can query sys.server_principals to get login related information.

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • The following will get you login names, SIDs and hashed passwords

    select name, sid, password_hash from sys.sql_logins

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • hi ,

    some one asked me that window authentication user-id and password are stored in which db.

    i replied to that person as there is no user-id and password for window authentication in sql server.

    am i false or true.

    only sql authentication user-id and password are there which is stored in master db.

    am i false or true.

  • You are right Ivan. When using Windows Authentication, the login credentials are checked in the Active Directory. No information is saved locally in SQL Server.

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • Ivan Mohapatra (4/4/2011)


    some one asked me that window authentication user-id and password are stored in which db.

    i replied to that person as there is no user-id and password for window authentication in sql server.

    With windows authentication, the login name is stored in master (query sys.server_principals) along with the SID (security identifier), but the password is not. The only place that stores the password is Active Directory

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 7 posts - 1 through 6 (of 6 total)

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