This is a quick post on how to Shrink a data or log file running a query. Tried Shrinking by going through Tasks->Shrink, but didn't work. This query managed to shrink the needed log file to 1MB (which was passed as a parameter).
Tested on Microsoft SQL Server 2008R2.
For more information, visit DBCC SHRINKFILE (Transact-SQL)