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
 SQL Server Development (2000)
 Update Query Help

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 NULL
140 2 10/10/2007 01/10/2007 340
191 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 the
date active, date archived and archive id. Archive id points to
previous record for that product in history and latest record's
Date Archived is always 01/01/1900 so it is a parameter in select
query. The problem I have is due to a bug a very large number of
records was updated without resetting Date Archived to next items
Date Active and without resetting Archive Id. So it looks something
like this:

----------------------
SupplierItemId BaseProductId DateActive DateArchived ArchiveId
30 2 01/09/2007 10/10/2007 NULL
140 2 10/10/2007 01/01/1900 30
191 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 NULL
140 2 10/10/2007 01/10/2007 340
191 2 15/01/2009 01/01/1900 140
Where did you get archived date from? shouldnt that be 15/01/2009?
Go to Top of Page

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...
Go to Top of Page
   

- Advertisement -