Search code examples
sql-servertruncatelogging

What is the command to truncate a SQL Server log file?


I need to empty an LDF file before sending to a colleague. How do I force SQL Server to truncate the log?


Solution

  • if I remember well... in query analyzer or equivalent:

    BACKUP LOG  databasename  WITH TRUNCATE_ONLY
    
    DBCC SHRINKFILE (  databasename_Log, 1)