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
 Import/Export (DTS) and Replication (2000)
 Update price list from Excel or CSV file

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-05 : 10:57:14
Paul writes "I have an ecommerce store running from SQL Server 2000. The main products table has over 34000 rows in 12 columns, each month I need to update the price or the image link field for a subset of up to 4000 of the rows. I thought the article on creating an array in a SP would help but it doesn't; I receive the updates in an Excel spreadsheet which just lists the partnumber and price - how do I update the correct rows in the dB? The price increase is not a straightforward percentage, each is different. To further complicate things, the part number I receive is the manufacturers and they are not totally unique, there are sometimes two or three items using the same number as just the quantity per pack changes!

I did look through the site and FAQ's, sorry if I missed a previous answer to this type of question."

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-07-05 : 11:20:21
Put simply...

Import your spreadsheet into a table.
Update your product table from your newly-created table.

Is your non-unique part number from the vendor the pk in your table?

<O>
Go to Top of Page

M.E.
Aged Yak Warrior

539 Posts

Posted - 2002-07-05 : 11:23:26
Interesting bit there...

First thing to do is to load all the data into a table. Use DTS to do this, nothing big.

2nd, you need to determine what makes each product unique. It can be more then one column if need be. From what I see ManufactureID and quantity will work.

Update ProductTable
set Price = NP.Price
from ProductTable inner join NewPriceTable NP on NP.ManufactureID = ProductTable.ManufactureID and NP.Quantity = ProductTable.Quantity

Hopefully that answers your question.
[edit] [/edit]
-----------------------
Take my advice, I dare ya

Edited by - M.e. on 07/05/2002 11:25:17
Go to Top of Page
   

- Advertisement -