Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Use sp_MSforeachdb but on a selected databases in the server

$
0
0

Hello. Please assist me. I am using sp_MSforeachdb and it is working so well with the below sytax:

DECLARE @command varchar(1000) 
SELECT @command = 
    'USE [?] exec sp_helpfile'         ---- exec sp_helpfile =query,you can replace how u wish.
EXEC sp_MSforeachdb @command

Now, my challenge is that there are a lot of databases (200) inside the server, some I do not have access to or they are not managed by me. So I want to use sp_MSforaechdb but only for the databases(20) that are of my responsibility. Please assist me with the syntax to include the loop on the above syntax that is already working.

Thanks


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>