I'm using a stored proc inside Sql 7.0 to add a record to a table taking parameters form an ASP form. I want to check one parameter to ensure it is a valid date. Here's the code..
Can't get this to work so the stored proc continues on to the insert statment where it attempts to insert a non-date in the date field and accordingly errors.
Any help would be appreciated
Code:
@inspection_date char(8),
@output_message nvarchar(255) output
as
declare @datecheck int
begin tran addnewsurveillance
--do some error checking
set @datecheck = (select isdate(@inspection_date))
if @datecheck = 0
begin
select @output_message = 'Inspection date is not a valid date format. Item not added.'
rollback tran addnewsurveillance
return
end
Can't get this to work so the stored proc continues on to the insert statment where it attempts to insert a non-date in the date field and accordingly errors.
Any help would be appreciated