dbTalk Databases Forums  

How to UPDATE one table from rows in another

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss How to UPDATE one table from rows in another in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
deacdb
 
Posts: n/a

Default How to UPDATE one table from rows in another - 06-16-2005 , 04:01 PM






I have exported data from table T (target table) to Excel and manually
changed some columns. Now I want to persist those values back into table T.

So I import the csv file into a staging table S that has the same structure
as T, let's say both look like
key (INT) name (CHAR) qty (INT)

What is the best way to update the rows of T from S?

thanks,
Deac






Reply With Quote
  #2  
Old   
Francesco Anti
 
Posts: n/a

Default Re: How to UPDATE one table from rows in another - 06-17-2005 , 08:41 AM






update T SET T.name=S.Name, T.Qty=S.Qty
FROM T, S
WHERE T.id=S.id

Francesco Anti

"deacdb" <deacdb2 (AT) hotmail (DOT) com> wrote

Quote:
I have exported data from table T (target table) to Excel and manually
changed some columns. Now I want to persist those values back into table
T.

So I import the csv file into a staging table S that has the same
structure as T, let's say both look like
key (INT) name (CHAR) qty (INT)

What is the best way to update the rows of T from S?

thanks,
Deac








Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.