Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8827947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:29:41+00:00 2026-06-14T07:29:41+00:00

I am learning the relations among authentication-user-role-schema. In my application I am using my

  • 0

I am learning the relations among authentication-user-role-schema. In my application I am using my Windows authentication which is assigned as sysadmin(as well as public) server role.

After that, when I am executing SELECT CURRENT_USER, I get dbo. However, I can’t find the mapping from the server role to the database user. I also tested by creating a login which has the server role as public. Using this login, I got guest when I executed SELECT CURRENT_USER.

So where does this mapping get defined?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:29:42+00:00Added an answer on June 14, 2026 at 7:29 am

    I figured out how to check the mapping, and what is the part confusing me. Firstly, the query to check the mapping between server login and the db user is something like this:

    SELECT
    SDP.PRINCIPAL_ID AS [Principal ID], 
    SDP.NAME AS [Database UserName], 
    SDP.TYPE_DESC AS [Datebase UserType],  
    SSP.NAME AS [Server LoginName], 
    SSP.TYPE_DESC AS [Server LoginType]
    FROM sys.database_principals SDP 
    INNER JOIN sys.server_principals SSP 
    ON SDP.sid = SSP.sid
    

    the sid is the unique identifier for all the principals including server level, db level.

    Secondly, the actual part which confused me it. It is because there is an implicit mapping and yet it won’t be shown even by the query. Let me describe my question again: I use my Windows login (let’s call it MY_W_NAME) as the authentication mode to log into SQL Server. And after that, when I execute select CURRENT_USER to one database, I get dbo, which is a database user. It’s only nature that I would assume there is an explicit mapping between MY_W_NAME and dbo and I want to find that. I am using SQL Server management studio and I see in the properties window of my the server login MY_W_NAME, there is one tab called User Mapping. So I was expecting to see a mapping here, only to find there is none. After I run the query above, I still can’t find MY_W_NAME listed there. so it is really mysterious how it is mapped.

    It turned out it is because MY_W_NAME is of server role ‘sysadmin’, and by default this login will be mapped into all ‘dbo’ database user for all the databases. But this mapping won’t be displayed by the query, nor on the user mapping tab in the properties window. Some further experiments show more interest facts: I actually can add a explicit mapping from MY_W_NAME to a specific database, for example, from script or from the properties window. However, even though I see the execution of creating a new DB user for MY_W_NAME is successful, when I run select CURRENT_USER to this DB, I still get dbo. I guess it is because ‘sysadmin’ really has higher privilege. On the contrary, if I created a server login with ‘public’ server role, and I add a mapping between this login to a DB user, this mapping will be displayed.

    I must say this is not a natural way to a normal human-being with limited experience in SQL Server. After a couple of days, finally someone pointed it out to me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Learning some VBA. So far, I've constructed this piece of code which should allow
I am using hibernate and have bi-directional relations. How should I correctly override equals()
I am using JQuery Mobile for an application. While it is a great framework,
I'm learning databases, using SqlCe, and need business object to database mapping. Currently I
I'm currently learning to use Core Data on iOS , in my test application
I have a problem. I'm learning JPA. I'm using embedded OpenEJB container in unit
I am building a double-entry accounting system in Rails, which includes: User. Attributes: user_id.
I'm doing a blog engine using symfony as a learning exercice. How do I
I'm learning cakephp for some time and it's very nice, I'm using the cake
As part of learning ruby/rails, I'm trying to implement http://github.com/professionalnerd/simple-private-messages into my application from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.