• Why do you need to convert COLUMNS_UPDATED() to @realUpdate?

    What's wrong with it as it is?

    And there is an easier way to do this conversion:

    SET @realUpdate = CONVERT(int, COLUMNS_UPDATED() )

    But you need to be sure you have less then 32 columns in the table, otherwise it will overflow int value.

    But main point remains the same: what do you need it for?

    There must be an easier way.

    _____________
    Code for TallyGenerator