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 |
aspnewbb
Starting Member
31 Posts |
Posted - 2006-08-07 : 23:20:49
|
Okay I have shopping cart system where the products in the users cart are stored in a seperate table with barcode, cost, quanity...now this system was just fine till we started running web specials that expire often and if the user kep the SALE price in their cart for longer then the sale, the cart let them keep it.now both of the databses contain over 400k records...and what i think i want to do (for now till a new cart system is in place) is runa manual sql statement (thru enterprice manager maybe) once a day (during off hours) to update all the COST of products in the CARTTABLE with the COST listed in the ACTUAL INventory table (which is wher ethe cost are updated manually now)... since they both have a value BARCODE where they can be compared...tblCart has BARCODE and CostPerUnittblInventory7 has BARCODE and COSTis there an UPDATE query I could run to have tblinventory7 update tblcartand is it remotely safe (since there are so many records I wager it would be taxing).. since I will be runing it for a month or so till we have a new syetem inplace taht updates the records at the same time.All and Any help is appreciated, thanks |
|
aspnewbb
Starting Member
31 Posts |
Posted - 2006-08-07 : 23:21:43
|
How does this look?Woudl it be safe to run on such huge databases?sql Code:Original - sql Codeupdate tblCart set tblCart.CostPerUnit=tblInventory7.COST from tblCart, tblInventory7 where tblCart.BARCODE=tblInventory7.BARCODE UPDATE tblCart SET tblCart.CostPerUnit=tblInventory7.COST FROM tblCart, tblInventory7 WHERE tblCart.BARCODE=tblInventory7.BARCODE How long do you think this query woudl take (im going to shut down teh site when i run it and woudl like any idea)?Also can someone explain to me how this works...does it just start with the first record in the tblCart database and move forward finding the first match in the tblINventory7 databsase matching/updating teh value and moving to next barcode? ... teach a man to fish and stuff |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-08-08 : 01:29:31
|
quote: How long do you think this query woudl take (im going to shut down teh site when i run it and woudl like any idea)?
How long will depends on the number of records which are going to affected. Its better that rather then directly running on the live db, just create an test enviorment, my taking the back up of the live one and running the update. if you can test the time accordingly. Chirag |
|
|
|
|
|