Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 select and insert statement merge together

Author  Topic 

christina_rules
Starting Member

23 Posts

Posted - 2007-06-09 : 01:14:31
is there anyway i can merge select statement and insert statement together?

what i want to do is select few attributes from a table and then directly insert the values to another table without another trigger.

for example, select * from product and with the values from product, insert into new_product (name, type, date) values (the values from select statment)

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-06-09 : 01:43:59
[code]INSERT INTO New_Product ( columns..)
SELECT (Columns...)
FROM Product
WHERE (Condition)
[/code]

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-09 : 01:45:04

Insert into new_product (name, type, date)
Select name, type, date from product

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-09 : 01:45:42

Dinakar, you are too fast

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -