I have an empty table SP.NotificationRuns. I have a stored procedure which includes the following:
select @from = max(WhenAttempted) from SP.NotificationRuns where WhenAttempted < @today if @@ROWCOUNT = 0 begin set @from = datetimefromparts(2000, 1, 1, 0, 0, 0, 0) end
When I step through this with the debugger, after performing the select statement, @@ROWCOUNT contains 1 and so it fails to set up the lower bound in the @from variable.
Can anyone suggest why please?
Michael