15 November,2016 by Tom Collins
Question: We have some scripts which dynamically generate sql code. For example on how to generate code for change all database owners to sa
SELECT 'use '+QUOTENAME(name)+ ' exec sp_changedbowner @loginame =''sa'' ' FROM sys.databases AS d WHERE d.database_id>4 and d.is_read_only = 0
I’d like to streamline the process and investigate some alternatives. One of the alternatives is to utilise sp_MSforeachdb.
What are the some of the disadvantage to using sp_MSforeachdb ?
Answer: sp_MSforeachdb has many benefits and is a very handy DBA tool . But it doesn’t satisfy all situations. These are some of the disadvantages
Performance Myth : Replacing a CURSOR with a WHILE LOOP and think you are not processing with a row
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |