Insert into create new table

2020-06-09 04:29发布

I have two large tables and want to combine all of the column names (not as a view) into a new table.

I do not have permission to right click on each table and choose CREATE TO SCRIPT, so I was wondering if there is a way to INSERT both Tables into a new table without specifying the column data types?

4条回答
我欲成王,谁敢阻挡
2楼-- · 2020-06-09 04:37
SELECT top 0 *
INTO NewTable
FROM BigTable1
    CROSS JOIN BigTable2
查看更多
三岁会撩人
3楼-- · 2020-06-09 04:42

You can use a SELECT INTO TSQL query - see MSDN link.

查看更多
成全新的幸福
4楼-- · 2020-06-09 04:53

If you have create rights you should be able to use an:

INSERT INTO MyTable SELECT statement to do this.

EDIT:

I had it wrong

SELECT * INTO MYNEWTABLE FROM MYSOURCETABLE
查看更多
别忘想泡老子
5楼-- · 2020-06-09 04:55

For T-SQL,

SELECT ...
INTO MyTable
FROM ...
查看更多
登录 后发表回答