In both Oracle and MySQL, you can do:
create table T1 as select * from T1
This CREATE TABLE AS statement basically clones table T1 with its structure and data in T2. This can be pretty handy at times.
The equivalent of that in Sql Server is SELECT INTO. For example, you can do:
select * into T2 from T1
to achieve similar results.
2 responses to “CTAS and Select Into”
[…] I mentioned here that SELECT INTO in Sql Server is functionally similar to CREATE TABLE AS in Oracle. Oracle also has SELECT INTO, but it is used for assigning query results to a variable. […]
[…] http://www.haidongji.com/2007/01/22/ctas-and-select-into/ The Ji Village News » CTAS and Select Into I mentioned here that SELECT INTO in Sql Server is functionally similar to CREATE TABLE AS in Oracle. Oracle also has SELECT INTO , but it is used for … […]