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 |
|
rb1373
Yak Posting Veteran
93 Posts |
Posted - 2004-11-16 : 10:47:30
|
| Does anyone know how to return user databases?On a development server, I would like to run a script nightly to shrink the databases, set the recovery modes to simple, etc.Thanks! |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-11-16 : 10:52:36
|
| SELECT name FROM master..sysdatabases WHERE name NOT IN ('master', 'model', 'msdb', 'tempdb')You may have additional system DB's if you have replication on that server. Just add those names to the IN list. |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-11-16 : 20:39:49
|
| select [name] from master..sysdatabases where id>4 and name<>'distribution'-which is the same as robvolk, just add 'distribution' (replication)--------------------keeping it simple... |
 |
|
|
|
|
|