• declare @NewKey int

    insert into table1(col) values (blah)

    select @NewKey=@@Identity

    If you're using SQL2K you should use the scope_identity() function instead.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/