Sometimes your recovery mode prevents you from clearing your log files. Change the recovery mode and then do SHRINKFILE
:SETVAR DB Datamart
:SETVAR __IsSqlCmdEnabled "True"GO
IF N'$(__IsSqlCmdEnabled)' NOT LIKE N'True'
BEGIN:SETVAR DB Datamart
:SETVAR __IsSqlCmdEnabled "True"GO
IF N'$(__IsSqlCmdEnabled)' NOT LIKE N'True'
PRINT N'SQLCMD mode must be enabled to successfully execute this script.';SET NOEXEC ON;END
GO
USE $(DB)
ALTER DATABASE $(DB) SET RECOVERY SIMPLE WITH NO_WAIT--SELECT name ,size/128.0 - CAST(FILEPROPERTY($(DB), 'SpaceUsed') AS int)/128.0 AS AvailableSpaceInMB
--FROM sys.database_files;DBCC SHRINKFILE ($(DB)_log,TRUNCATEONLY)--SELECT name ,size/128.0 - CAST(FILEPROPERTY([$(DB)], 'SpaceUsed') AS int)/128.0 AS AvailableSpaceInMB
--FROM sys.database_files;ALTER DATABASE [$(DB)] SET RECOVERY FULL WITH NO_WAIT