Eliminate duplicate,max record

  • All,

    create table asset

    (

    assetid int,

    atype int,

    dt datetime,

    ret int,

    freq int,

    val decimal(28,10) null,

    ds int

    )

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jan 31 1997 12:00AM',2,3,190.9999900000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 28 1997 12:00AM',2,3,122.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 1997 12:00AM',2,3,109.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 1997 12:00AM',2,3,130.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 1997 12:00AM',2,3,118.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 1997 12:00AM',2,3,108.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 1997 12:00AM',2,3,95.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 1997 12:00AM',2,3,87.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 1997 12:00AM',2,3,119.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 1997 12:00AM',2,3,-32.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Nov 30 1997 12:00AM',2,3,53.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 1997 12:00AM',2,3,79.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jan 31 1998 12:00AM',2,3,-26.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 28 1998 12:00AM',2,3,98.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 1998 12:00AM',2,3,128.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 1998 12:00AM',2,3,75.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 1998 12:00AM',2,3,40.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 1998 12:00AM',2,3,-80.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 1998 12:00AM',2,3,106.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 1998 12:00AM',2,3,-143.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 1998 12:00AM',2,3,-362.0000200000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 1998 12:00AM',2,3,-801.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Nov 30 1998 12:00AM',2,3,52.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 1998 12:00AM',2,3,120.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jan 31 1999 12:00AM',2,3,157.9999900000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 28 1999 12:00AM',2,3,208.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 1999 12:00AM',2,3,160.0000100000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 1999 12:00AM',2,3,106.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 1999 12:00AM',2,3,72.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 1999 12:00AM',2,3,88.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 1999 12:00AM',2,3,51.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 1999 12:00AM',2,3,-28.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 1999 12:00AM',2,3,92.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 1999 12:00AM',2,3,87.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Nov 30 1999 12:00AM',2,3,106.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 1999 12:00AM',2,3,97.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jan 31 2000 12:00AM',2,3,41.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 29 2000 12:00AM',2,3,97.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 2000 12:00AM',2,3,-61.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 2000 12:00AM',2,3,-6.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 2000 12:00AM',2,3,107.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 2000 12:00AM',2,3,58.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 2000 12:00AM',2,3,18.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 2000 12:00AM',2,3,107.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 2000 12:00AM',2,3,76.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 2000 12:00AM',2,3,6.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Nov 30 2000 12:00AM',2,3,66.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 2000 12:00AM',2,3,48.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jan 31 2001 12:00AM',2,3,163.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 28 2001 12:00AM',2,3,54.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 2001 12:00AM',2,3,51.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 2001 12:00AM',2,3,94.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 2001 12:00AM',2,3,68.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 2001 12:00AM',2,3,17.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 2001 12:00AM',2,3,54.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 2001 12:00AM',2,3,105.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 2001 12:00AM',2,3,-13.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 2001 12:00AM',2,3,134.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Nov 30 2001 12:00AM',2,3,-24.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 2001 12:00AM',2,3,53.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jan 31 2002 12:00AM',2,3,86.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 28 2002 12:00AM',2,3,56.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 2002 12:00AM',2,3,45.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 2002 12:00AM',2,3,113.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 2002 12:00AM',2,3,99.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2002 12:00AM',2,3,-166.0000000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 2002 12:00AM',2,3,69.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 31 2002 12:00AM',2,3,-147.4476000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 2002 12:00AM',2,3,57.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2002 12:00AM',2,3,53.6691000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 2002 12:00AM',2,3,97.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2002 12:00AM',2,3,19.5052000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 2002 12:00AM',2,3,-33.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2002 12:00AM',2,3,179.3033000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 2002 12:00AM',2,3,-63.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2002 12:00AM',2,3,21.1374000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Nov 30 2002 12:00AM',2,3,54.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2002 12:00AM',2,3,112.4950000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 2002 12:00AM',2,3,153.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2003 12:00AM',2,3,105.2841000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jan 31 2003 12:00AM',2,3,106.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 28 2003 12:00AM',2,3,-8.8461000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 28 2003 12:00AM',2,3,79.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 31 2003 12:00AM',2,3,29.5130000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 2003 12:00AM',2,3,19.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2003 12:00AM',2,3,296.2236000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 2003 12:00AM',2,3,91.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 31 2003 12:00AM',2,3,630.6564000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 2003 12:00AM',2,3,207.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2003 12:00AM',2,3,29.5725000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 2003 12:00AM',2,3,44.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 31 2003 12:00AM',2,3,-19.6569000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 2003 12:00AM',2,3,-92.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2003 12:00AM',2,3,87.7350000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 2003 12:00AM',2,3,43.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2003 12:00AM',2,3,281.3277000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 2003 12:00AM',2,3,105.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2003 12:00AM',2,3,191.6271000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 2003 12:00AM',2,3,35.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2003 12:00AM',2,3,2.5409000000,4)

    go

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Nov 30 2003 12:00AM',2,3,69.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2003 12:00AM',2,3,110.0762000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 2003 12:00AM',2,3,101.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2004 12:00AM',2,3,230.3183000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jan 31 2004 12:00AM',2,3,92.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 29 2004 12:00AM',2,3,45.0266000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 29 2004 12:00AM',2,3,84.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 31 2004 12:00AM',2,3,-47.2698000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 2004 12:00AM',2,3,3.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2004 12:00AM',2,3,-226.8261000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 2004 12:00AM',2,3,62.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 31 2004 12:00AM',2,3,23.0000000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 2004 12:00AM',2,3,40.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2004 12:00AM',2,3,15.8836000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 2004 12:00AM',2,3,55.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 31 2004 12:00AM',2,3,-22.5357000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 2004 12:00AM',2,3,62.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2004 12:00AM',2,3,152.2503000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 2004 12:00AM',2,3,36.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2004 12:00AM',2,3,37.0798000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 2004 12:00AM',2,3,12.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2004 12:00AM',2,3,55.0037000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 2004 12:00AM',2,3,28.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2004 12:00AM',2,3,393.5336000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Nov 30 2004 12:00AM',2,3,75.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2004 12:00AM',2,3,329.1438000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 2004 12:00AM',2,3,60.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2005 12:00AM',2,3,-165.0316000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jan 31 2005 12:00AM',2,3,44.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 28 2005 12:00AM',2,3,196.4120000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 28 2005 12:00AM',2,3,85.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 31 2005 12:00AM',2,3,-97.8310000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 2005 12:00AM',2,3,24.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2005 12:00AM',2,3,-127.9007000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 2005 12:00AM',2,3,-3.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 31 2005 12:00AM',2,3,219.5500000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 2005 12:00AM',2,3,-10.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2005 12:00AM',2,3,69.0807000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 2005 12:00AM',2,3,10.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 31 2005 12:00AM',2,3,135.7057000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 2005 12:00AM',2,3,81.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2005 12:00AM',2,3,24.5463000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 2005 12:00AM',2,3,36.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2005 12:00AM',2,3,54.9084000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 2005 12:00AM',2,3,62.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2005 12:00AM',2,3,-52.3947000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 2005 12:00AM',2,3,57.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2005 12:00AM',2,3,-137.9822000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Nov 30 2005 12:00AM',2,3,15.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2005 12:00AM',2,3,135.3994000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 2005 12:00AM',2,3,54.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2006 12:00AM',2,3,249.3692000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jan 31 2006 12:00AM',2,3,93.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 28 2006 12:00AM',2,3,5.0688000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 28 2006 12:00AM',2,3,41.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 31 2006 12:00AM',2,3,107.8382000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 2006 12:00AM',2,3,55.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2006 12:00AM',2,3,173.2780000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 2006 12:00AM',2,3,121.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 31 2006 12:00AM',2,3,3.5191000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 2006 12:00AM',2,3,59.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2006 12:00AM',2,3,109.7587000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 2006 12:00AM',2,3,36.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 31 2006 12:00AM',2,3,171.8978000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 2006 12:00AM',2,3,64.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2006 12:00AM',2,3,-78.6809000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 2006 12:00AM',2,3,37.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2006 12:00AM',2,3,101.3723000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 2006 12:00AM',2,3,14.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2006 12:00AM',2,3,218.4599000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 2006 12:00AM',2,3,67.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2006 12:00AM',2,3,132.9503000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Nov 30 2006 12:00AM',2,3,60.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2006 12:00AM',2,3,216.9183000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 2006 12:00AM',2,3,72.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2007 12:00AM',2,3,482.7052000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jan 31 2007 12:00AM',2,3,69.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 28 2007 12:00AM',1,3,1322.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 28 2007 12:00AM',2,3,1305.0973000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 28 2007 12:00AM',2,3,106.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 31 2007 12:00AM',2,3,-25.0490000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 2007 12:00AM',2,3,60.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2007 12:00AM',1,3,12.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2007 12:00AM',2,3,-0.5460000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 2007 12:00AM',2,3,71.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 31 2007 12:00AM',1,3,165.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 31 2007 12:00AM',2,3,149.5878000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 2007 12:00AM',2,3,55.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2007 12:00AM',1,3,588.9946700000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2007 12:00AM',1,3,600.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2007 12:00AM',2,3,579.3126000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 2007 12:00AM',2,3,48.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 31 2007 12:00AM',1,3,1173.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 31 2007 12:00AM',2,3,1149.5831000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 2007 12:00AM',2,3,7.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2007 12:00AM',1,2,45.6017100000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2007 12:00AM',1,2,58.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2007 12:00AM',1,3,58.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2007 12:00AM',1,3,58.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2007 12:00AM',2,3,46.5137000000,4)

    go

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 2007 12:00AM',2,3,-28.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2007 12:00AM',1,3,100.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2007 12:00AM',1,3,100.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2007 12:00AM',2,3,78.9796000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 2007 12:00AM',2,3,178.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 12 2007 12:00AM',1,2,144.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 12 2007 12:00AM',1,2,144.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 19 2007 12:00AM',1,2,240.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 19 2007 12:00AM',1,2,240.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 26 2007 12:00AM',1,2,353.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 26 2007 12:00AM',1,2,353.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2007 12:00AM',1,2,415.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2007 12:00AM',1,2,415.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2007 12:00AM',1,3,399.4595800000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2007 12:00AM',1,3,415.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2007 12:00AM',2,3,397.6582000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 2007 12:00AM',2,3,96.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 2 2007 12:00AM',1,2,116.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 2 2007 12:00AM',1,2,116.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 9 2007 12:00AM',1,2,131.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 9 2007 12:00AM',1,2,131.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 16 2007 12:00AM',1,2,12.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 16 2007 12:00AM',1,2,12.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 23 2007 12:00AM',1,2,86.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 23 2007 12:00AM',1,2,86.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2007 12:00AM',1,2,-10.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2007 12:00AM',1,2,-10.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2007 12:00AM',1,3,-20.7900200000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2007 12:00AM',1,3,-10.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2007 12:00AM',2,3,-20.3569000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Nov 30 2007 12:00AM',2,3,-94.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 7 2007 12:00AM',1,2,34.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 7 2007 12:00AM',1,2,34.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 11 2007 12:00AM',1,2,34.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 11 2007 12:00AM',1,2,34.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 14 2007 12:00AM',1,2,-26.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 14 2007 12:00AM',1,2,-26.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 18 2007 12:00AM',1,2,-26.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 18 2007 12:00AM',1,2,-26.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 21 2007 12:00AM',1,2,23.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 21 2007 12:00AM',1,2,23.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 27 2007 12:00AM',1,2,23.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 27 2007 12:00AM',1,2,23.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 28 2007 12:00AM',1,2,39.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 28 2007 12:00AM',1,2,39.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2007 12:00AM',1,2,41.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2007 12:00AM',1,2,41.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2007 12:00AM',1,3,29.0786000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2007 12:00AM',1,3,41.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2007 12:00AM',2,3,22.1345000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 2007 12:00AM',1,3,42.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 2007 12:00AM',2,3,36.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 4 2008 12:00AM',1,2,65.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 4 2008 12:00AM',1,2,65.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 11 2008 12:00AM',1,2,47.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 11 2008 12:00AM',1,2,47.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 18 2008 12:00AM',1,2,113.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 18 2008 12:00AM',1,2,113.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 25 2008 12:00AM',1,2,31.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 25 2008 12:00AM',1,2,31.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 28 2008 12:00AM',1,2,31.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 28 2008 12:00AM',1,2,31.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2008 12:00AM',1,2,57.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2008 12:00AM',1,2,57.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2008 12:00AM',1,3,57.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2008 12:00AM',1,3,57.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2008 12:00AM',2,3,48.9347000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 1 2008 12:00AM',1,2,6.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 1 2008 12:00AM',1,2,6.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 8 2008 12:00AM',1,2,153.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 8 2008 12:00AM',1,2,153.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 15 2008 12:00AM',1,2,248.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 15 2008 12:00AM',1,2,248.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 22 2008 12:00AM',1,2,280.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 22 2008 12:00AM',1,2,280.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 29 2008 12:00AM',1,2,373.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 29 2008 12:00AM',1,2,373.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 29 2008 12:00AM',1,3,373.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 29 2008 12:00AM',1,3,373.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 29 2008 12:00AM',2,3,356.3887000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 29 2008 12:00AM',2,3,-49.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 7 2008 12:00AM',1,2,195.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 7 2008 12:00AM',1,2,195.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 14 2008 12:00AM',1,2,214.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 14 2008 12:00AM',1,2,214.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 21 2008 12:00AM',1,2,-123.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 21 2008 12:00AM',1,2,-123.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 28 2008 12:00AM',1,2,22.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 28 2008 12:00AM',1,2,22.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 31 2008 12:00AM',1,2,15.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 31 2008 12:00AM',1,2,15.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 31 2008 12:00AM',1,3,3.3044300000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 31 2008 12:00AM',1,3,15.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 31 2008 12:00AM',2,3,1.2483000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 2008 12:00AM',2,3,-306.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 4 2008 12:00AM',1,2,-125.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 4 2008 12:00AM',1,2,-125.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 11 2008 12:00AM',1,2,1.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 11 2008 12:00AM',1,2,1.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 18 2008 12:00AM',1,2,-114.0000000000,5)

    go

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 18 2008 12:00AM',1,2,-114.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 25 2008 12:00AM',1,2,-182.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 25 2008 12:00AM',1,2,-182.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2008 12:00AM',1,2,-130.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2008 12:00AM',1,2,-130.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2008 12:00AM',1,3,-140.2682300000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2008 12:00AM',1,3,-130.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2008 12:00AM',2,3,-136.0516000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2008 12:00AM',2,3,-136.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 2008 12:00AM',2,3,187.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 16 2008 12:00AM',1,2,8.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 16 2008 12:00AM',1,2,8.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 23 2008 12:00AM',1,2,140.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 30 2008 12:00AM',1,2,117.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 30 2008 12:00AM',1,2,117.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 31 2008 12:00AM',1,3,104.0680400000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 31 2008 12:00AM',1,3,117.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 31 2008 12:00AM',1,3,117.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 31 2008 12:00AM',2,3,98.2791000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 2008 12:00AM',2,3,103.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 6 2008 12:00AM',1,2,65.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 13 2008 12:00AM',1,2,-35.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 20 2008 12:00AM',1,2,-1.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 27 2008 12:00AM',1,2,81.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2008 12:00AM',1,2,98.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2008 12:00AM',1,3,84.6267400000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2008 12:00AM',1,3,98.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2008 12:00AM',2,3,87.2979000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 2008 12:00AM',1,3,-20.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 2008 12:00AM',2,3,-27.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 4 2008 12:00AM',1,2,-11.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 11 2008 12:00AM',1,2,46.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 18 2008 12:00AM',1,2,-88.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 29 2008 12:00AM',1,2,-110.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 31 2008 12:00AM',1,2,-171.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 31 2008 12:00AM',1,3,-181.1160300000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 31 2008 12:00AM',1,3,-171.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 31 2008 12:00AM',2,3,-180.9524000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 2008 12:00AM',1,3,-23.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 2008 12:00AM',2,3,-23.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 1 2008 12:00AM',1,2,-35.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 8 2008 12:00AM',1,2,-14.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 15 2008 12:00AM',1,2,-2.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 19 2008 12:00AM',1,2,48.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 22 2008 12:00AM',1,2,73.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 29 2008 12:00AM',1,2,53.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2008 12:00AM',1,3,40.8011200000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2008 12:00AM',1,3,53.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2008 12:00AM',2,3,41.3275000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 2008 12:00AM',1,3,-1.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 2008 12:00AM',2,3,-3.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 5 2008 12:00AM',1,2,-56.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 12 2008 12:00AM',1,2,71.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 19 2008 12:00AM',1,2,71.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 26 2008 12:00AM',1,2,-63.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2008 12:00AM',1,2,-38.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2008 12:00AM',1,3,-49.5135800000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2008 12:00AM',1,3,-38.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 2008 12:00AM',1,3,-485.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2008 12:00AM',2,3,-50.8168000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 2008 12:00AM',2,3,-506.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 3 2008 12:00AM',1,2,-13.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 10 2008 12:00AM',1,2,-182.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 17 2008 12:00AM',1,2,137.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 24 2008 12:00AM',1,2,-15.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2008 12:00AM',1,2,100.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2008 12:00AM',1,3,100.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2008 12:00AM',1,3,89.2862700000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 2008 12:00AM',1,3,-701.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2008 12:00AM',2,3,93.7104000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 2008 12:00AM',2,3,-867.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 7 2008 12:00AM',1,2,152.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 14 2008 12:00AM',1,2,197.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 21 2008 12:00AM',1,2,160.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 28 2008 12:00AM',1,2,46.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2008 12:00AM',1,3,46.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2008 12:00AM',1,3,36.2912500000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Nov 30 2008 12:00AM',1,3,-283.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2008 12:00AM',2,3,35.1288000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Nov 30 2008 12:00AM',2,3,-308.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 5 2008 12:00AM',1,2,46.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 12 2008 12:00AM',1,2,115.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 19 2008 12:00AM',1,2,177.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 26 2008 12:00AM',1,2,-26.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2008 12:00AM',1,3,97.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2008 12:00AM',1,2,97.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2008 12:00AM',1,3,86.5121700000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 2008 12:00AM',1,3,26.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2008 12:00AM',2,3,90.4317000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Dec 31 2008 12:00AM',2,3,-35.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 2 2009 12:00AM',1,2,92.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 9 2009 12:00AM',1,2,111.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 16 2009 12:00AM',1,2,165.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 23 2009 12:00AM',1,2,295.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 30 2009 12:00AM',1,2,295.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2009 12:00AM',1,3,200.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2009 12:00AM',1,3,191.0000000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jan 31 2009 12:00AM',1,3,95.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2009 12:00AM',2,3,185.0000000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 27 2009 12:00AM',1,2,-80.0000000000,9)

    go

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 28 2009 12:00AM',1,3,-80.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 28 2009 12:00AM',1,3,-91.0000000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 28 2009 12:00AM',1,3,88.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Feb 28 2009 12:00AM',2,3,-90.0243000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Feb 28 2009 12:00AM',2,3,65.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 6 2009 12:00AM',1,2,194.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 13 2009 12:00AM',1,2,167.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 20 2009 12:00AM',1,2,167.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 27 2009 12:00AM',1,2,104.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 31 2009 12:00AM',1,3,138.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 31 2009 12:00AM',1,2,138.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 2009 12:00AM',1,3,101.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Mar 31 2009 12:00AM',2,3,127.2608000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Mar 31 2009 12:00AM',2,3,57.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 3 2009 12:00AM',1,2,-81.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 10 2009 12:00AM',1,2,-87.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 17 2009 12:00AM',1,2,-140.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 24 2009 12:00AM',1,2,-156.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2009 12:00AM',1,3,-111.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 2009 12:00AM',1,3,343.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Apr 30 2009 12:00AM',2,3,-121.0000000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Apr 30 2009 12:00AM',2,3,221.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 1 2009 12:00AM',1,2,14.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 8 2009 12:00AM',1,2,167.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 15 2009 12:00AM',1,2,109.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 22 2009 12:00AM',1,2,122.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 29 2009 12:00AM',1,2,247.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 31 2009 12:00AM',1,3,247.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'May 31 2009 12:00AM',2,3,231.0000000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 2009 12:00AM',1,3,335.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'May 31 2009 12:00AM',2,3,365.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 5 2009 12:00AM',1,2,36.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 12 2009 12:00AM',1,2,90.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 19 2009 12:00AM',1,2,14.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 26 2009 12:00AM',1,2,10.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2009 12:00AM',1,3,42.0448000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 2009 12:00AM',1,3,116.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jun 30 2009 12:00AM',2,3,42.0000000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jun 30 2009 12:00AM',2,3,126.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 10 2009 12:00AM',1,2,-57.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 17 2009 12:00AM',1,2,-28.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 24 2009 12:00AM',1,2,-1.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 31 2009 12:00AM',1,3,-41.4559000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jul 31 2009 12:00AM',2,3,-40.0000000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Jul 31 2009 12:00AM',2,3,322.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 7 2009 12:00AM',1,2,49.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 14 2009 12:00AM',1,2,81.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 21 2009 12:00AM',1,2,103.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2009 12:00AM',1,3,73.3903000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2009 12:00AM',1,2,61.5103000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 2009 12:00AM',1,3,202.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Aug 31 2009 12:00AM',2,3,73.0000000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Aug 31 2009 12:00AM',2,3,202.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 4 2009 12:00AM',1,2,-10.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 11 2009 12:00AM',1,2,20.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 18 2009 12:00AM',1,2,-4.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 25 2009 12:00AM',1,2,-38.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2009 12:00AM',1,3,-4.6766000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Sep 30 2009 12:00AM',1,3,267.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Sep 30 2009 12:00AM',2,3,-6.0000000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 2 2009 12:00AM',1,2,-10.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 9 2009 12:00AM',1,2,4.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 16 2009 12:00AM',1,2,44.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 23 2009 12:00AM',1,2,8.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2009 12:00AM',1,3,-49.1981000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,2,'Oct 31 2009 12:00AM',1,3,194.0000000000,5)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Oct 31 2009 12:00AM',2,3,-49.0000000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 6 2009 12:00AM',1,2,-10.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 13 2009 12:00AM',1,2,38.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 20 2009 12:00AM',1,2,21.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 27 2009 12:00AM',1,2,9.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2009 12:00AM',1,3,-6.5949000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Nov 30 2009 12:00AM',2,3,-8.0000000000,4)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 4 2009 12:00AM',1,2,101.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 11 2009 12:00AM',1,2,88.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 18 2009 12:00AM',1,2,109.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 25 2009 12:00AM',1,2,146.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Dec 31 2009 12:00AM',1,3,116.1651000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 8 2010 12:00AM',1,2,35.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 15 2010 12:00AM',1,2,26.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 22 2010 12:00AM',1,2,-35.0000000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 29 2010 12:00AM',1,2,-57.0849000000,9)

    insert into dbo.asset ( assetid, atype, dt, ret, freq, val, ds) values (1,1,'Jan 31 2010 12:00AM',1,3,-57.0849000000,9)

    I would like to

    1) Eliminate the records where as ds column value has maximum for a given date.

    karthik

  • sample :

    112007-10-12 00:00:00.0001214.400000005

    112007-10-12 00:00:00.0001214.400000009

    112007-10-19 00:00:00.0001224.000000005

    112007-10-19 00:00:00.0001224.000000009

    112007-10-26 00:00:00.0001235.300000005

    112007-10-26 00:00:00.0001235.300000009

    112007-10-31 00:00:00.0001241.500000005

    112007-10-31 00:00:00.0001241.500000009

    112007-10-31 00:00:00.0001339.945960005

    112007-10-31 00:00:00.0001341.500000009

    112007-10-31 00:00:00.0002339.765820004

    122007-10-31 00:00:00.000239.600000005

    Expected result:

    112007-10-12 00:00:00.0001214.400000005

    112007-10-26 00:00:00.0001235.300000005

    112007-10-31 00:00:00.0001241.500000005

    112007-10-31 00:00:00.0001339.945960005

    112007-10-31 00:00:00.0002339.765820004

    122007-10-31 00:00:00.000239.600000005

    karthik

  • I don't want to use DISTINCT or GROUP BY function. Because the table has 150,000 records.

    karthik

  • Just missing one thing from your posts, the code for what you have done so far to solve your problem. Please, show us what you have tried so far instead of relying on us to just do your work for you.

  • You may need to play with the joins a bit to make sure I got all the neccsary ones

    DELETE FROM a

    FROM #asset a

    INNER JOIN

    (

    select *,[rank] = rank() OVER(Partition By assetid,atype,dt, val order by ds)

    from #asset

    ) b

    ON

    a.assetid = b.assetid

    and a.atype = b.atype

    and a.dt = b.dt

    and a.ds = b.ds

    WHERE

    b.rank = 2

    Jim

  • Hi,

    Here is what I would use, the row_number function partitioned by your datetime.

    Try this script carefully before you uncomment the delete section.

    ;

    WITH cte

    AS ( SELECT dt ,

    ds ,

    ROW_NUMBER() OVER ( PARTITION BY dt ORDER BY ds DESC ) AS RowNum

    FROM dbo.asset

    )

    SELECT *

    FROM Cte

    ORDER BY RowNum ASC

    /*

    delete from cte where RowNum = 1

    */

    Cheers,

    J-F

  • Here is my solution since everyone else is just jumping without seeing what the OP has tried to do to solve his problem.

    with FindDups as (

    select

    assetid,

    atype,

    dt,

    ret,

    freq,

    val,

    ds,

    max(ds) over (partition by dt) as maxds,

    count(ds) over (partition by dt) as cntds

    from

    dbo.asset

    )

    select

    assetid,

    atype,

    dt,

    ret,

    freq,

    val,

    ds

    from

    FindDups

    where

    ds <> maxds or cntds = 1 -- records with dups removed

    -- ds = maxds and cntds > 1 -- this will find the duplicate records you want to delete

  • Lynn,

    I tried the below code

    with final

    as( select assetid,

    atype,

    dt,

    ret,

    freq,

    val,

    ds ,

    ROW_NUMBER() over ( partition by assetid,atype,dt,ret,freq,dt order by ds asc ) as id

    from asset

    )

    select *

    FROM final where id = 1

    order by dt

    karthik

  • Lynn,

    My code is displying 420 rows.

    your's is displaying 344 rows.

    Let me check the output.

    karthik

  • my attempt at the query--

    with mycte as

    ( select row_number() over (partition by dt order by ds desc) as rowid,*

    from asset)

    select * from mycte

    where rowid <> 1

    thanks

    Pankaj

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply