Need Help to write Purge Job on Large table

  • Hi Friends ,

    i need help in writing Purge Script on One table Name Logins, Requirement is we need 90 Days Retention, partitioning, Purge rate is 10k batches. Please find the Table structure below

    [dbo].[Logins](

    [AccountNumber] [varchar](20) NOT NULL,

    [Loginid] [varchar](10) NOT NULL,

    [ProductCode] [varchar](3) NOT NULL,

    [SubProductCode] [varchar](3) NOT NULL,

    [TranDate] [datetime] NOT NULL,

    [TranAmount] [numeric](19, 2) NOT NULL,

    [VarcharData1] [varchar](50) NULL,

    [SubscriptionTypeId] [smallint] NOT NULL,

    [CreateDate] [datetime] NOT NULL

    Please help on this please

  • this will delete anything older than 90 days based on CreatedDate

    DELETE FROM dbo.logins

    WHERE CreateDate < CONVERT(CHAR(10),DATEADD(DD,-90,GETDATE()),121);

    i.e, anything older than 2011-11-04 (assuming its run today)

    [font="Times New Roman"]There's no kill switch on awesome![/font]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply