Results 1 to 3 of 3
Feb 2, 2010, 04:26 #1
- Join Date
- Feb 2008
- 0 Post(s)
- 0 Thread(s)
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 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: