在 SQL Server 中,这会将 100 条记录从 Customers 表插入到 tmpFerdeen 中:-
SELECT top(100)* INTO tmpFerdeen FROM Customers
是否可以跨 UNION ALL SELECT 执行 SELECT INTO :-
SELECT top(100)* FROM Customers UNION All SELECT top(100)* FROM CustomerEurope UNION All SELECT top(100)* FROM CustomerAsia UNION All SELECT top(100)* FROM CustomerAmericas
不太确定在哪里添加 INTO 子句。
这适用于 SQL Server:
SELECT * INTO tmpFerdeen FROM ( SELECT top 100 * FROM Customers UNION All SELECT top 100 * FROM CustomerEurope UNION All SELECT top 100 * FROM CustomerAsia UNION All SELECT top 100 * FROM CustomerAmericas ) as tmp