sql >> Base de Datos >  >> Database Tools >> SSMS

Insertar T-SQL en la tabla sin tener que especificar cada columna

En realidad, puedes hacer esto muy fácilmente:

-- Select everything into temp table
Select * Into 
    #tmpBigTable
    From [YourBigTable]

-- Drop the Primary Key Column from the temp table  
Alter Table #tmpBigTable Drop Column [PrimaryKeyColumn]

-- Insert that into your other big table
Insert Into [YourOtherBigTable]
    Select * From #tmpBigTable

-- Drop the temp table you created
Drop Table #tmpBigTable

Siempre que tenga la inserción de identidad activada en "YourOtherBigTable" y las columnas sean absolutamente idénticas, estará bien.