SQL Server Performance

How to query

Discussion in 'T-SQL Performance Tuning for Developers' started by sfunds, Mar 31, 2009.

  1. sfunds New Member

    Hi ,
    I download data in csv format.
    The data has futures quotes for 3 months with following rows
    Symbol , expiry date , open ,high ,low, close, timestamp
    for each symbol there will be 3 quotes 1 with expiry date of one month ,2 with expiry date 2 month hence and 3rd with 3 months
    I want to store this data in
    Future1 , Future2 and Future3
    Future1 to contain all 1 month contract and so on
  2. FrankKalis Moderator

    Ahem, but what exactly now is your question please?
    I would use the import wizard or write a simple SSIS package to get the data from csv to SQL Server.
  3. sfunds New Member

    the table in csv format issee below
  4. sfunds New Member

    the table in csv format is
    INSTRUMENTSYMBOL EXPIRY_DTOPENHIGHLOWCLOSETIMESTAMP

    FUTSTK3IINFOTECH30-Apr-0933.0535.432.834.71-Apr-09
    FUTSTK3IINFOTECH28-May-09353535351-Apr-09
    FUTSTK3IINFOTECH25-Jun-0900031.751-Apr-09
    FUTSTKABAN 30-Apr-09391405.75376385.31-Apr-09
    FUTSTKABAN 28-May-09381.05398370.35378.351-Apr-09
    FUTSTKABAN 25-Jun-09381.35381.35381.35381.351-Apr-09
    FUTSTKABB 30-Apr-09429.5431.9413.5423.21-Apr-09
    FUTSTKABB 28-May-090004181-Apr-09
    FUTSTKABB 25-Jun-09000418.751-Apr-09
    FUTSTKABGSHIP 30-Apr-0983.5586.380.784.951-Apr-09
    FUTSTKABIRLANUVO30-Apr-09442470442459.751-Apr-09
    FUTSTKABIRLANUVO28-May-09000434.51-Apr-09
    FUTSTKABIRLANUVO25-Jun-09000430.051-Apr-09
    FUTSTKACC30-Apr-09572.8586.95569.75831-Apr-09
    FUTSTKACC28-May-095705705705701-Apr-09
    FUTSTKACC25-Jun-09000572.951-Apr-09
    The table shows a part of Futures traded I want to insert in to future table I have three future tableFuture1 , future2 and future3In Future1 i need all instrument which expires on 30-apr-09 In Future2 i need all instrument which expires on 28-may-09 In Future3 i need all instrument which expires on 25-jun-09 How do i do this The problem is i want to write it generic and i dont want to use exact expiry dates as it falls on last thursday or if it is holiday on friday
  5. FrankKalis Moderator

    Load the data into a staging table and then use a calendar table to insert matching rows into the final table. Since a characteristics of a future is its standardization it should be possible to grab the expiry dates some source like Reuters, Bloomberg, etc... and have a column in your calendar table which indicates whether a given date is an expiry date or not. that way you could safe to hardcode the expiry days in your import. You just have to maintain the calendar table.
  6. satya Moderator

    As you need to control the process out side of SQL Server you will need to perform data calculations within SSIS packages, as referred by Frank you could follow.
  7. satya Moderator

    Do you need to store the data in seperate worksheets or as rows?

Share This Page