Hey guys -

Trying to return records from a database given a particular date range. Basically it returns the records fall in the past year at the point when the procedure is run...

I hope that makes sense.
Trouble is it won't run!

Can someone take a look please?

Thanks

Code SQL:
ALTER PROCEDURE [dbo].[delete_built_on]
 
 @START AS datetime,
 @END AS datetime
 
AS
BEGIN
 
SET @START = GETDATE()
SET @END = DateAdd(yy, -1, GetDate())
 
SELECT decision_date, DATEDIFF(MONTH, decision_date, GETDATE()) AS 'How Old', application_id_int, claimant_id_int
FROM application
WHERE app_closed_date > @START AND app_closed_date < @END AND built_on_bit = 'TRUE'
ORDER BY 'How Old' ASC
 
END

It is asking for values of start and end when I run this:

Code SQL:
EXEC delete_built_on

Thanks again.

DS