I have run this code and it gives me the following message:
Server: Msg 208, Level 16, State 1, Line 3
Invalid object name 'sys.database_files'.
Server: Msg 208, Level 16, State 1, Line 3
Invalid object name 'sys.database_files'.
I am running SQL Server 2000 and not 2005 so this might be the problem? Sorry for omitting that info in original post.
Main Topics
Browse All Topics





by: maradamPosted on 2008-01-25 at 01:47:05ID: 20741259
Assuming only one log file for each database you can do that like this. Note, that this will not truncate the log. If you like to do this add the following statement before dbcc shrinkfile:
declare @db sysname set @db = db_name()
backup database @db with truncate_only
Plase be warned that truncating the log will break log sequence. So don't truncate your logs if you have databases with recovery model other than simple
Select allOpen in new window