SQL Queries for Bulk Editing of Product Table

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
I'm new to this so I wasn't really sure where to ask this. I am in the process of importing about 420,000 products into version 3.80. The files contain my cost (ProductCost) and MSRP (Price). The problem is that several did not have an MSRP (Price) value or it is not enough margin to be published. I want to leave the MSRP values in the (Price) column so that I can move them to the (OldPrice) column and I think I can change the string value of products.price.oldprice to "MSRP" to display MSRP price to the customers and adjust the (Price) with a percentage increase over (ProductCost). Now I'll get to my question. I can't seem to get this query correct. I want to set (Published) to false if (Price) is < (ProductCost) + 10%.

I tried this but it didn't work.

UPDATE dbo.Product
set Published=False
WHERE Price < (.10>ProductCost)
7 years ago
This should work:

UPDATE Product
   SET Published = 0
WHERE Price < ProductCost*1.1
7 years ago
Thanks Pete.


This got it.

UPDATE dbo.Product SET Published=0 WHERE Price is not null and Price < (1.10 * ProductCost)
7 years ago
I get a csv price file once a week from my supplier and I need to update the ProductCost column based on the sku. If the SKU matches then update the ProductCost with the value from the csv file. I think this might work but would really like some input from someone more experienced.

UPDATE Product SET ProductCost=source.price
FROM
OPENROWSET('MICROSOFT.JET.OLEDB.4.0',  
'Text;Database=C:\path to file location\PRICE.csv;',  
'SELECT * FROM [price.csv]') as source,product P
where P.sku=source.sku COLLATE database_default

Thanks in advance for any help!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.