[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

EXEC sp_MSForEachDB need to miss table

Posted on 2007-11-14
3
Medium Priority
?
642 Views
Last Modified: 2008-02-07
I am using a script to check for information in all db on server...

I need it not do do certain tables - like master, wrtemp any  suggestions

@doit - contain the select statement

EXEC sp_MSForEachDb @command1=@doit
0
Comment
Question by:James Murrell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20278298
you have to check, in the @doit, what the value of ? is...

like this:

set @doit = ' IF ''?'' IN (''master'', ''tempdb'', ''model'', ''msdb'' ) begin ' + @doit + ' END '
EXEC sp_MSForEachDb @command1=@doit
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 20278299
sorry: NOT IN:

set @doit = ' IF ''?'' NOT IN (''master'', ''tempdb'', ''model'', ''msdb'' ) begin ' + @doit + ' END '
EXEC sp_MSForEachDb @command1=@doit
0
 
LVL 31

Author Comment

by:James Murrell
ID: 20278348
that makes sense - thanks
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question