You are here: Re: How to update selected columns of a table in SQL server db using data from a Excel file? « MsSQL Server « IT news, forums, messages
Re: How to update selected columns of a table in SQL server db using data from a Excel file?

Posted by Ed Murphy on 04/04/07 03:55

urprettyfriend wrote:

> I have an Excel file with 400 rows of old values and the corresponding
> new values. My table currently has 10 columns out of which 3 columns
> use the old value specified in the excel file. I need to update those
> old values in the columns with the new values from the Excel file.
> Please guide me as to how to proceed with this.

Import the data into a second table, then do something like this:

update Table1
set t1.c4 = t2.c4,
t1.c5 = t2.c5,
t1.c6 = t2.c6,
t1.c7 = t2.c7,
t1.c8 = t2.c8,
t1.c9 = t2.c9,
t1.c10 = t2.c10
from Table1 t1
join Table2 t2 on t1.c1 = t2.c1
and t1.c2 = t2.c2
and t1.c3 = t2.c3

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация