You can write a query that can script this out for you. Assuming I understand your requirements...
Code:
Select 'Alter Login [' + Name + '] With DEFAULT_DATABASE = MyDatabaseName'
From sys.syslogins
Where dbname = 'Master'
When you run the code shown above, it will display in the output window. You should be able to copy/paste the output window to a new query window and run it. This also gives you an opportunity to see what logins will be modified before actually changing anything.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.