T-SQL Insert into table without having to specify every column
问题 In our db there is a table that has a little over 80 columns. It has a primary key and Identity insert is turned on. I'm looking for a way to insert into this table every column EXCEPT the primary key column from an identical table in a different DB. Is this possible? 回答1: You can do this quite easily actually: -- Select everything into temp table Select * Into #tmpBigTable From [YourBigTable] -- Drop the Primary Key Column from the temp table Alter Table #tmpBigTable Drop Column