Enable All Users
https://mytechmantra.com/LearnSQLServer/How-to-Enable-Database-Users-in-SQL-Server/
I have converted it to do it for all databases.
sp_MSforeachdb 'USE [?]; SELECT ''USE [?]; GRANT CONNECT TO ['' + SU.name + ''];'' FROM [?].sys.database_principals DP
INNER JOIN [?].sys.sysusers SU ON dp.principal_id = SU.uid
WHERE DP.TYPE IN (''G'',''U'')
AND SU.hasdbaccess = 0
'
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home