How to distinguish between system and user defined roles in a single database? Is there a way to distinguish between a system role/user and a user defined role/user? As system role/user I understand a role/user which is installed/assigned implicitly at the time the database has been created. As user defined role/user I understand a role/user created "manually" afterwards.

The only way I have found is by looking at the result of

select * from sys.database_principals order by create_date, is_fixed_role desc


or by comparing the result with a freshly created database. Is there another way?
The column 'is_fixed_role' on sys.database_principals is your answer, check the MS document:


  If 1, this row represents an entry for one of the fixed database
  roles: db_owner, db_accessadmin, db_datareader, db_datawriter,
  db_ddladmin, db_securityadmin, db_backupoperator, db_denydatareader,
  db_denydatawriter.


Just use

SELECT * FROM sys.database_principals WHERE [type]='R' and [is_fixed_role]=1