• I keep getting this error "Deletion length 23 is not in the range of available text, ntext, or image data" inconsistently when this scripts run. It is failing on the replacement of the Email address to the value |TO|.

    -- set the start position for the TO Address

    SELECT @TOpos = patindex('%' + @TO + '%', ExtensionSettings) - 1

    FROM Subscriptions WHERE SubscriptionID = @subscriptionID

    SELECT @length = len(@TO)

    IF @length > 0

    -- replace the addresses with the original |TO|

    UPDATETEXT Subscriptions.ExtensionSettings

    @ptrval

    @TOpos

    @length

    '|TO|'