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 |
masterslave
Starting Member
22 Posts |
Posted - 2008-02-06 : 01:14:49
|
I've got data that looks like this to keep track of product changes:SupplierItem table----------------------SupplierItemId BaseProductId DateActive DateArchived ArchiveId 30 2 01/09/2007 10/10/2007 NULL140 2 10/10/2007 01/10/2007 340191 2 15/01/2009 01/01/1900 140 What it's used for is keeping track of product changes like cost, description etc (not including those in the example) by using thedate active, date archived and archive id. Archive id points toprevious record for that product in history and latest record'sDate Archived is always 01/01/1900 so it is a parameter in selectquery. The problem I have is due to a bug a very large number of records was updated without resetting Date Archived to next itemsDate Active and without resetting Archive Id. So it looks somethinglike this:----------------------SupplierItemId BaseProductId DateActive DateArchived ArchiveId 30 2 01/09/2007 10/10/2007 NULL140 2 10/10/2007 01/01/1900 30191 2 15/01/2009 01/01/1900 30 So what I need to do is update items for that Base Product with earlier Date Archived to be latest item's Date Active and set Archive Id appropriately as well... Any advice much appreciated! |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-06 : 01:57:43
|
SupplierItemId BaseProductId DateActive DateArchived ArchiveId 30 2 01/09/2007 10/10/2007 NULL140 2 10/10/2007 01/10/2007 340191 2 15/01/2009 01/01/1900 140 Where did you get archived date from? shouldnt that be 15/01/2009? |
 |
|
masterslave
Starting Member
22 Posts |
Posted - 2008-02-06 : 17:58:13
|
Do you mean for the latest record for a product? Well I made it 01/01/1900 because at this stage it's valid from Date Active to indefinitely... |
 |
|
|
|
|