I am getting following error while I am trying to delete 355447 records in single delete query.
The transaction log for database is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
I tried foll. solution, But still delete statement throwing same error.
DBCC SHRINKFILE(DBname_Log, 2)
BACKUP LOG gis_sync WITH TRUNCATE_ONLY
DBCC SHRINKFILE(DBname_Log, 2)
Please help me to solve.... Thanks
This question is related to
sql-server
As an aside, it is always a good practice (and possibly a solution for this type of issue) to delete a large number of rows by using batches:
WHILE EXISTS (SELECT 1
FROM YourTable
WHERE <yourCondition>)
DELETE TOP(10000) FROM YourTable
WHERE <yourCondition>
Source: Stackoverflow.com