Sql server insert into select

This article is tagged with: Sql server insert into select and mysql

sql server insert into select

INSERT INTO sales.addresses (street, city, state, zip_code)
SELECT
    street,
    city,
    state,
    zip_code
FROM
    sales.customers
ORDER BY
    first_name,
    last_name;

insert into select

INSERT INTO table2 (column1, column2, column3, ...)
SELECT column1, column2, column3, ...
FROM table1
WHERE condition;

insert into select

INSERT INTO table2 (column1, column2, column3, ...)
SELECT column1, column2, column3, ...
FROM table1
WHERE condition;

insert into select

INSERT INTO table2
SELECT * FROM table1
WHERE condition;

This article is tagged with: Sql server insert into select and mysql