lundi 30 janvier 2017

Date calculation within If-then Statement

I need to calculate the numbers of days between two date fields based on whether one of the dates is null or not. If the date variable is null I need to incorporate today's date. Please help with SQL.

ex.
if dbo.nameoftable[date1] <> " " then time = [date1] - [date2] elseif dbo.nameoftable[date1] = " " then time = ?todays date - [date2]endif;

Thank you!!

Aucun commentaire:

Enregistrer un commentaire