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: