Solved

filtering in sp_Msforeachdb

Posted on 2011-09-26
4
576 Views
Last Modified: 2012-05-12

sp_Msforeachdb 'IF ''?'' NOT IN (''tempdb'') alter database ? set recovery simple'
gives error
Option 'RECOVERY' cannot be set in database 'tempdb'.

why is the filtering now happening?
0
Comment
Question by:25112
  • 2
  • 2
4 Comments
 
LVL 31

Expert Comment

by:James Murrell
ID: 36600813
What version of sql?

0
 
LVL 5

Author Comment

by:25112
ID: 36600816
i am running on 2008
0
 
LVL 31

Accepted Solution

by:
James Murrell earned 500 total points
ID: 36600977
This works for me is sql 2008

EXEC sp_MSforeachdb 'IF ''?'' NOT IN ( ''tempdb'')  
Begin  
Declare @cmd varchar(255)
set @cmd = ''ALTER DATABASE [?] SET RECOVERY SIMPLE''
exec (@cmd)
End'


James
0
 
LVL 5

Author Comment

by:25112
ID: 36601277
good.

practically, what is the difference between yours and mine?
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Addition to SQL for dynamic fields 6 37
Help with SQL Server Polygon 2 32
Run SQL Server Proc from Access 11 28
SQL Error - Query 6 24
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

786 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