stored procedure date variable trouble
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?
ALTER PROCEDURE [dbo].[delete_built_on]
@START AS datetime,
@END AS datetime
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
WHERE app_closed_date > @START AND app_closed_date < @END AND built_on_bit = 'TRUE'
ORDER BY 'How Old' ASC
It is asking for values of start and end when I run this: