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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 query

Author  Topic 

vicki
Posting Yak Master

117 Posts

Posted - 2002-04-12 : 11:00:04
Hi,
Is there any way to insert the column? For example:
Table1: 6 columns
Table 2: 4 columns

First2 columns from table 2 are same as table1, and now all I want just either insert/update last two columns from table 2 into table 1

How can I do it?

thanks

Peter Dutch
Posting Yak Master

127 Posts

Posted - 2002-04-12 : 11:18:11
UPDATE Table1
SET t1.Column5 = t2.Column3, t1.Column6 = t2.Column4
FROM Table1 t1 INNER JOIN Table2 t2 ON t1.Column1 = t2.Column1

This of course assumes (as I read from your post) that both tables can be joined on the first columns.

Go to Top of Page
   

- Advertisement -