VSSGeorge
SSCrazy Eights
Points: 8151
More actions
January 22, 2014 at 9:35 pm
#303691
Hi
I am getting a division by zero error when start date > end date
Error handler required
my query is:
set @datediff1 = (select datediff(day,@start_date1,@end_date1)+1)
Koen Verbeeck
SSC Guru
Points: 259115
January 22, 2014 at 11:52 pm
#1682643
You can either use try/catch or check with a CASE statement if @datediff1 is 0. If it is, don't do the division and return 0, if it isn't do the division.
Need an answer? No, you need a questionMy blog at https://sqlkover.com.MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply