• Testing in SQL2000, it does not even allow a variable when used with the IDENTITY function. You could do something like this, however.

    exec ('select field1,

    IDENTITY(int,' + @val1 + ',1) AS [ID]

    into #temp_list

    from table2

    select * from #temp_list order by [ID]')