Hmm. I thought it would change the focus until the focus was changed again. If not, that would explain things. I did try to put the USE command again in front of the SHRINKFILE command, but got the same errors.
>The USE command has effect only for duration of EXECUTE command.
>
>>I did not know that. I can do that now, but I also need to take care of the DBs already there. Any suggestions?
>>
>>>AFAIK, any new DB created uses the system model DB as template. Did you try to set the SIMPLE recovery mode for it?
>>>
>>>>There is probably a much better way to do this, but this is not working anyway.
>>>>
>>>>ShairPoint (MOSS) creates its own DBs. Evidently it can not be told to create them in SIMPLE recovery mode, and in this case, 100s of DBs have been created. I am trying to change the recovery mode to SIMPLE and shrink the log file for every DB (not system DBs) in a script. In the script (below) I try to change the DB focus using the USE command, but evidently it is not working as I thought, because I get errors that say the log file can not be found in the master.
>>>>
>>>>"Could not locate file 'ReportServer_log' for database 'master' in sys.database_files."
>>>>
>>><snip>
Thank You
Rollin Burr
Politicians and diapers have one thing in common. They should both be changed regularly, and for the same reason.