• I didn't post the actual code because its long gone. What I needed to do was a multi step process with a derived set of data. Something you would use a cursor for. Since I don't like cursors, my solution is:

    declare @cnt int, @max-2 int

    set @cnt = 1

    declare @t table(somekey Int identity(1,1), tablePK Int)

    INSERT @t (tablePK) select somePK from Table1 where blah = blah

    set @max-2 = (select MAX(somekey) from @t)

    WHILE @cnt < @max-2

    BEGIN

    -- DO multi step process here

    set @cnt = @cnt + 1

    END

    All I want to know is, what is the darn difference between a column set as an identity column in a table variable if it has it set as a primary key, or not set as a primary key.

    I am not planning on not using a table var, Im not changing anything, I just want to know why setting the column as a primary key would ever make it run SLOWER?

    Thanks