Calculate in a field, number of days between two dates


I need to calculate in a field, number of days between two dates.

In my database I have 3 fields:

  1. Date of Request
  2. DeliveryDate
  3. Number of Days

I basically what I need is:

  1. In Number of Days, calculate the difference between the application time and the delivery time.
  2. That if the date of application and delivery of the same, that is not left with value “0”, there should say “1”.

I was reading, even in the forum that can be done with the macro macro sc_date_dif, but failed to do so.

I leave the link dates


If you’re working on a grid application, might be easier to let sql server do the calculations, then giving you resultset with the correct number of days.