• Thanks for the quick reply.

    I'll give it a try with the ITVF, and see if it solves my problem!? 🙂

    BTW, the @st it a datetime var used by the cursor, the update statement it's inside this cursor. It gets all info for all the pac's (kind off products), the production start time @st, the production end time @ed, and the quantity @QT, and the @id.

    The cursor runs through all the pac's, gets the difference (@diff), between the start date and the end date in working days, divide the quantity for the number of days (@qtDay), then i update every date for the @pac with the @qtDay and with the @Id, the ids, it's just to know what pac are summing in the date.

    I could put here all the code, but it has several lines before this phase and everything it's connected and it will be complicated to explain every line...