• Here is a modification of the trigger which allows for multi-row inserts and uses the CONVERT function.

    😎

    CREATE TRIGGER dbo.scancode_scancode_autogen

    ON SCANCODE

    AFTER Insert

    NOT FOR REPLICATION AS

    SET NoCount On

    SET ARITHABORT ON

    UPDATE S

    SET S.scancode = CONVERT(VARCHAR(12),CONVERT(VARBINARY(4),I.scancode_id + 55555,0),1)

    FROM dbo.scancode S

    INNER JOIN inserted I

    ON S.scancode_id = I.scancode_id