Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 12963

Users with logins but cant query from syslogins based on name?

$
0
0

Im trying to modify the list of users what I want to use when "re-mapping" users to logins after a DB restore.  I only care about users and their logins that WE have created, not system level accounts just as 'NT AUTHORITY\SYSTEM' , SA, Sys etc...

So I am starting with this list I get

SELECT u.name ,u.uid FROM sys.syslogins l INNER JOIN sys.sysusers u ON l.loginname = u.name;
However, in the list that results, I dont see the users that obviously exist in the database AND have a login with a matching name.  

For example, there is a user "SALESUSER" as a user in the DB, and has a login, but its not returned in the above query.

Why?



Viewing all articles
Browse latest Browse all 12963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>