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.
Author |
Topic |
sqlpal2007
Posting Yak Master
200 Posts |
Posted - 2007-10-23 : 11:19:03
|
Hello All,Why do I get the different count when I try to run the following query to get the users from a database.select u.name from DB1..sysusers u inner join master..syslogins m on m.sid = u.sid where u.name not like 'NA%' order by u.nameselect name from DB1..sysusers where name not like 'NA%' order by nameThe first query returns less records and the second one gives more. What does this SID join do?Thanks,-P |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-10-23 : 11:26:21
|
Probably you have logins that don't have permissions in the database - i.e. aren't mapped to the database.You also might have orphan users which will be missed by the first query.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-10-23 : 23:04:48
|
More likely orphan users in db1, can double check with sp_helpuser. You'll see users that mapped to null sql login. |
 |
|
|
|
|