My knowledge in SQL server 2008 is limited and I couldn't find exactly how to do this. My idea is to use the result of a SELECT procedure as a list of column names (based on the procedure created in this old question How do you return the column names from a table?) I would like to do something like:
INSERT INTO new_table (SELECT COLUMN_NAME,* FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'YourTableName' AND TABLE_SCHEMA='YourSchemaName')
SELECT (SELECT COLUMN_NAME,* FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'YourTableName' AND TABLE_SCHEMA='YourSchemaName') FROM YourTableName
What I'm trying to do is to fill up a bigger table with data from a table that has less columns (all of them are contained in the bigger table). Maybe there is a better way to do this.