Sree Divya (6/29/2016)
Hi,we are using below script for delete records.but it is taking time
USE AdventureWorks2008R2;
GO
DELETE * FROM Purchasing.PurchaseOrderDetail
WHERE DueDate = '20020701';
GO
is there any possibility of chance to delete the rows from table WHERE DueDate = '20020701'; USING CTE Funcion.
Can we any one provide the script for faster deletes
A cte will NOT be any faster. How many transactions are there on a single date that you would notice any kind of lag during the delete?
You could try and put the database in simple recovery mode to minimize logging.
ALTER DATABASE database_name SET Recovery SIMPLE
-- Do Deletes
ALTER DATABASE CIS SET Recovery FULL
Or you could delete in batches if you can refine the Where clause.
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/