troubleshooting Question

SQL statement to delete records from a table based on date range.

Avatar of niceoneishere
niceoneishere asked on
ASP.NETMicrosoft SQL Server 2005SQL
18 Comments1 Solution450 ViewsLast Modified:
I my website is based on sql server 2005 and ASP.NET 2.0. (C#) I track all the website errors thru a table called Exceptions and this table has now more than 200000 records.

I trying to clean it up a little. basically remove all the records from the years 2007 till 2011.

how can i do this without impacting the site as well as the database.

my table is as follows

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

Thanks and appreciate it
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 18 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros