Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    38

    Unanswered: insert data depending on year value in table

    Hi there,

    Can anyone help? I currently have this query that imports distinct data into a prices table with a couple of contraints. This table became to large so I have now split this down into yearly tables (dbo.price --> dbo.price2001, dbo.price2002 etc). I get the data each day in another table that may contain data for different years so I need to be able to look at this data and insert into the right yearly tables.

    E.g. present query:

    Insert Prices
    select distinct M.ids, C.zdateT, 1.0,0 from mapid as M,datacorrect as C
    where M.asset = 'money'
    and C.zDate not in (select zdate from price where sid >=15)


    So I need to run this query for each yearly table with a date listed in the datacorrect table (insert prices(yr) yr = 2002,2003,2004 etc)

    Any ideas would be appreciated!!

    Thanks

    S

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Look up Partitioned View in Books online....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Jan 2004
    Posts
    38
    Thanks for the advice, greatly appreciated.

    S

  4. #4
    Join Date
    Jan 2004
    Posts
    38

    partition view will be too slow on size of the table

    Hi,

    After looking at the partitioned view, by using this method the stored proc will take too long to run as the data being accessed is about 20 GB. Is there another way to solve the original problem?

    Thanks

    S

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •