• Lowell (3/5/2013)


    That trigger emulates what a column with an identity does... so you can simply define the column as having an identity and skip the trigger completely.

    Create table tbname (colname int identity(1,1) not null.........

    Given that this is a SQL 2012 forum, the OP can also use the new SEQUENCE object, which could be the only feature that gives the exact same implementation. The Oracle sequence could well be something other than int from 1 to N increment by 1.

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service