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
 insert and update table at same time

Author  Topic 

CrazyT
Yak Posting Veteran

73 Posts

Posted - 2010-04-28 : 19:13:58
basically i select from table 1 to update table 2.

the record from table 1 has 3 columns -- one columns is an update of an existing record

the second columns requires a record to be inserted.

How do i do an insert and select at the same time?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-04-28 : 19:20:29
If you are using SQL Server 2008, you can use the new MERGE function.


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

CrazyT
Yak Posting Veteran

73 Posts

Posted - 2010-04-28 : 19:26:38
its sql 2005
Go to Top of Page
   

- Advertisement -