Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
nhuanlieu
Starting Member
27 Posts |
Posted - 2009-05-18 : 16:09:37
|
HI, i'd like to dynamically generate & run a SQL scripts against all development databases to set recovery to simple. But when I do it thru a set (cursor) dynamically, it does not like it with the error msg below. I am using "Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86)". Is that a bug/restriction? IF not, any idea how I'd get around that? Thanks.Msg 2812, Level 16, State 62, Line 34Could not find stored procedure ' ALTER DATABASE ZedBogus SET RECOVERY SIMPLE '. |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2009-05-18 : 16:58:56
|
Try this:EXEC sp_msforeachdb 'ALTER DATABASE ? SET RECOVERY SIMPLE' sp_msforeachdb uses a cursor to enumerate databases. You may get errors on master, msdb, or tempdb but the statement should still run against the other databases. You may need to put brackets [] around the ? in the code. |
 |
|
nhuanlieu
Starting Member
27 Posts |
Posted - 2009-05-18 : 19:11:06
|
Thanks, that will work. |
 |
|
|
|
|