asked on
USE [MsiteDB]
GO
/****** Object: Table [dbo].[ExceptionLog] *****/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ExceptionLog](
[Id] [int] IDENTITY(1,1) NOT NULL,
[ExceptionMessage] [varchar](max) NOT NULL,
[ExceptionTime] [datetime] NOT NULL,
CONSTRAINT [PK_ExceptionLog] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
ASKER
ASKER
ASKER
ASKER
The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications
TRUSTED BY
Do you want to remove through 2011 or through 2010?
1) Convert the date range to an Id range, since id is the clustering key
2) delete in batches, to reduce locks
DECLARE @ending_id int
DECLARE @max_rows_to_delete_at_one
DECLARE @rows_deleted int
SELECT @ending_id = MAX(id)
FROM dbo.ExceptionLog WITH (NOLOCK)
WHERE
ExceptionTime < '20110101' --<< remove all thru 2010; change to '20120101' to remove all of 2011 also