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 8828865
In Process

The Archive Base Latest Questions

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

This sounds stupid but I find it really confusing: in MSDN the definition is

  • 0

This sounds stupid but I find it really confusing: in MSDN the definition is the entity that can request SQL Server resources. And basically there are three types of principals: Windows-level principals, SQL Server-level principals and Database-level principals. So far it’s fine. Only that it gives me an impression that the identifier of one principal should be different than others, no matter what type this principle is.(If all principals of these three types could be arranged in one table, they would have unique identifiers)

The confusing part comes from these three queries below:

1)

Select name,principal_id from sys.database_principals 

(Note: I run it on one database)

2)

Select name,principal_id from sys.server_principals

Now I know the first one returns database user principals while the second one returns server user principals (correct me if I am wrong). But why one row from the first query can have the same principal_id as one from the second query? For example, one row from the database principals would be:

name:INFORMATION_SCHEMA, principal_id: 3

while one row from the second query is

name:sysadmin, principal_id: 3

What are these two principal_id? As I mentioned, I thought the identifiers of two principals would be different, even if one is a DB user and the other is server user(and from the name I assume principal_id is the identifier).

Well, if the principal_id is not unique for all principals, but only unique at each query’s range(the principal_id from the first query are only identifiers for database users, so it can happen to be the same as one from server users), I then have a third query and don’t understand what does it mean:

3)

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.PRINCIPAL_ID = SSP.PRINCIPAL_ID

If the two principal_id are only unique within their ranges, what does it mean to make an inner join on both principal_id ? An inner join means this column is jointly unique, right?

There must be something very elementary that I misunderstand. Thanks for any help on that!

  • 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:42:15+00:00Added an answer on June 14, 2026 at 7:42 am

    There is no correspondence between principal_ids on sys.database_principals and sys.server_principals. On the first, it’s only documented to be unique within the database. On the second, they’re unique across the server. And there’s no documented relationship between these columns in the same views.

    In fact, low numbered principal_ids are highly likely to be assigned in both views, and the principals that they relate to are unrelated.

    So the query showing a join between the two views using principal_id is wrong.

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

Sidebar

Related Questions

This may sounds like a stupid question but can't find anything on google, probably
Cocoa newbie here... I know this sounds stupid but I can't find the Bindings
This may sound very stupid question , but I can't find any documentation that
This may sound like a stupid question but I can't seem to find an
this might question might sounds stupid, but I could'nt figure it out. How can
Possible Duplicate: SQL Server Random Sort I guess it sounds stupid but I want
This might sound stupid but how can i find the last characters index in
I know this sounds like a stupid question, but I really don't see the
I know this sounds very stupid indeed, but I find mysqli prepared statements and
This sounds like a stupid question (to me), but I've searched and I can't

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.