I have a temp table with the exact structure of a concrete table T. It was created like this: select top 0 * into #tmp from T
After processing and filling in content into #tmp, I want to copy the content back to T like this: insert into T select * from #tmp
This is okay as long as T doesn't have identity column, but in my case it does. Is there anyways I can ignore the auto-increment identity column from #tmp when I copy to T? My motivation is to avoid having to spell out every column name in the Insert Into list.
EDIT: toggling identity_insert wouldn't work because the pkeys in #tmp may collide with those in T if rows were inserted into T outside of my script, that's if #tmp has auto-incremented the pkey to sync with T's in the first place.