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.
| Author |
Topic |
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2009-06-25 : 03:59:36
|
| [code]I have an existing tableCustomers---------customerID name percentage---------- ---- ----------1812 Jones 1115 Nicholls 2231 Worthington1775 GallagherA temporary table has been created as the result of a CSV importTemp----customerID percentage---------- ----------1775 34.561115 17.21812 97.252231 67.2I want to update the Customer table to givecustomerID name percentage---------- ---- ----------1812 Jones 97.251115 Nicholls 17.2 2231 Worthington 67.21775 Gallagher 34.56How can I do this please? The complete table is around a million records.I mention this in case if affects the method required.[/code] |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-25 : 04:02:43
|
[code]UPDATE cSET c.Percentage = w.PercentageFROM Customer AS cINNER JOIN Temp AS t ON t.CustomerID = c.CustomerID[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2009-06-25 : 04:09:23
|
| Many thanks for the reply. I assume that the 'w' in SET c.Percentage = w.Percentageis a typo? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-25 : 04:48:28
|
Yes. Replace "w." to "t." E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|