In oracle, you can issue:
create table foo as select * from bar;
What is the equivalent T-SQL statement?
You can create one table from another by adding a SELECT statement at the end of the CREATE TABLE statement: CREATE TABLE new_tbl [AS] SELECT * FROM orig_tbl; MySQL creates new columns for all elements in the SELECT .
On the Design tab, in the Query Type group, click Make Table. The Make Table dialog box appears. In the Table Name box, enter a name for the new table. Click the down-arrow and select an existing table name.
Description. SELECT INTO creates a new table and fills it with data computed by a query. The data is not returned to the client, as it is with a normal SELECT . The new table's columns have the names and data types associated with the output columns of the SELECT .
SQL Server SELECT statement is used to fetch the data from a database table which returns data in the form of result table. These result tables are called result-sets.
You can use SELECT INTO
. From MSDN:
The SELECT INTO statement creates a new table and populates it with the result set of the SELECT statement. SELECT INTO can be used to combine data from several tables or views into one table. It can also be used to create a new table that contains data selected from a linked server.
So:
SELECT col1, col2, col3 INTO newTable FROM existingTable;
You can try like this:
select * into foo from bar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With