New answers tagged logins
Instead of migrating or transferring all the users from server A to server B, you should have identified the orphan users for the migrated databases. Say from server 1 , as you said you moved database A and B: 1) Find orphan users on database A- Once you have found them , mapped the orphan users with help of script you used earlier to find the logins on ...
This should put you in the right direction: DECLARE @results TABLE ( database_name sysname, db_user_name sysname, login_name sysname ); INSERT @results EXEC sp_MsForEachDB ' USE [?]; SELECT DB_NAME() AS database_name, dp.name AS db_user_name, sp.name AS login_name FROM sys.database_principals dp INNER JOIN sys.server_principals sp ...
You should be able to do something like this EXECUTE AS login = 'loginname'; SELECT name FROM sys.databases WHERE HAS_DBACCESS(name) = 1 For reference see EXECUTE AS and HAS_DBACCESS
Top 50 recent answers are included