Hey friends, I usually get questions and concerns like "how do I shrink this database", "the logfile is so big", "please help me".
How do I shrink a database?
DBCC SHRINKDATABASE('databasename', 10)
-- 10 is the amount of percent free space in the database after the shrink operation
How do I shrink a transactionlog?
DBCC SHRINKFILE(2, 10)
-- 2 is the second file of the database, usually the transactionlog
-- 10 is the amount of percent free space in the file after the shrink operation
How do I get stats ablout the transactionlog?
These two queries might be of help...
select * from sys.dm_db_log_stats(db_id())
select * from sys.dm_db_log_info(db_id())