There is a significant difference between SQL Server 2008 and 2005, and the data file shrinkage method is as follows:
Alter DATABASE Database SET RECOVERY SIMPLE With NO_WAIT GO Alter DATABASE Database SET RECOVERY SIMPLE - Simple Mode GO Use Database GO DBCC SHRINKFILE (N database file id, 10, TRUNCATEONLY).
--' Database file id; It's a SELECT file_ID, name From sys. database_Files found
GO
Alter DATABASE Database SET RECOVERY FULL With NO_WAIT
GO
Alter DATABASE Database SET RECOVERY Full -- Restore to Full Mode
GO.
You can also back up the logs first and then shrink them:
Use database
GO
Backup LOG Database TO DISK=' e: /mylog. bak'
DBCC SHRINKFILE (N database file id, 10)
GO.