DEFINITIONS

Definitions More Info.
Definition ID62
TitleSQL
CategorySCRIPT
DefinitionDELETE_LOCK_YAPMADAN
Definition DescriptionSELECT 1
WHILE @@ROWCOUNT > 0
BEGIN
DELETE TOP (1000)
FROM tblLog
where LogId < 24966742 END
--------------------------------------- ----------------------------------------
VEYA
DECLARE @CallId int
DECLARE @calldate AS VARCHAR(100)
DECLARE @calldate2 AS VARCHAR(100)
SET @calldate=CONVERT(VARCHAR(10),DATEADD(month, DATEDIFF(month, 0, SYSDATETIME())-2, 0),120)
SET @calldate2=CONVERT(VARCHAR(10),DATEADD(month, DATEDIFF(month, 0, SYSDATETIME())-1, 0),120)
DECLARE CallId_Cursor CURSOR FOR
SELECT CallId
FROM WebServiceCallLog WITH(NOLOCK)
WHERE CallDate>=@calldate
and CallDate<@calldate2
OPEN CallId_Cursor;
FETCH NEXT FROM CallId_Cursor
INTO @CallId
WHILE @@FETCH_STATUS = 0
BEGIN
--TOP Ne kadar kucuk tutarsak o kadar lock engellenmis olur.
DELETE TOP(100)
FROM WebServiceCallLog
WHERE CallId=@CallId
FETCH NEXT FROM CallId_Cursor
INTO @CallId END;
CLOSE CallId_Cursor
DEALLOCATE CallId_Cursor;
END
RecordBycunay
Record Date15-02-2012 16:14:04
Düzenle
Kopyala
Sil