how to insert values into table based on another column in sql server code example Example: insert select INSERT INTO table2 SELECT * FROM table1 WHERE condition;