Groups | Blog | Home
all groups > sql server data mining > october 2006 >

sql server data mining : Delete Procedure or Query - HELP


GTN170777
10/23/2006 12:22:02 PM
Hi,

I'm trying to write some code that automatically deletes all records that
were posted over 183 days ago. The code needs to run continuosly, so far i've
written the code below, which doesn't work, any ideas how to write the
(query/Procedure?trigger???) correctly -

CREATE PROCEDURE deletevacancy
AS
BEGIN
DELETE VacancyID,
VacancyEmployeeID,
VacancyEmployerID,
VacancyTitle,
VacancyCategory,
VacancyLocation,
VacancyType,
VacancyPaye,
VacancyPayeType,
VacancyStartDate,
VacancyDatePosted,
VacancyPostedFor,
VacancyReference,
VacancyDescription,
VacancyDuration
FROM [dbo].[Vacancy]
WHERE VacancyDatePosted > DATEADD(DAY, 182, GETDATE())
END

Michael Abair
10/23/2006 4:01:55 PM
WHERE VacancyDatePosted < DATEADD(DAY -182, GETDATE())

--
Michael Abair
Programmer / Analyst
Chicos FAS Inc.


[quoted text, click to view]

GTN170777
10/25/2006 1:09:01 PM
Thanks Michael,

Is it a procedure that i need to write? and is the -

CREATE PROCEDURE deletevacancy
AS
BEGIN

correct?

Thanks a lot

[quoted text, click to view]
AddThis Social Bookmark Button