Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
How do you determine which role is the preferred one?Very simply you could do a SELECT UserID, MAX(RoleID) AS RoleID INTO #DistinctFROM yourTableGROUP BY UserIDDELETE FROM yourTableINSERT INTO yourTable SELECT * FROM #DistinctBut this won't discriminate - it will keep the role ID with the highest value and lose the rest.