TSQL insert from select - INSERT INTO SELECT

SQLSQL Server

Please contribute by voting. Thanks!
1

Do you need to insert data into a table that comes from another table / a select-query? No problem, this is how it's done...

INSERT INTO TableA (columnA, columnB, columnInt, columnVarChar)
SELECT      TableB.columnZ, TableB.columnY, 123, 'foo bar'
FROM        TableB
WHERE       TableB.columnInt2 = 256;

Article created: May 29 at 13:46. Edited May 29 at 13:49.

Your comment

You need to sign up / log in to comment this article

Author

Created by Faith Logan [4] May 29 at 13:46

Share article

Do you know about

ASP.NET?

Write an article