sql server limit

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bing

    sql server limit

    I'm storing time series data in a table in SQL server 2000. The table
    has columns like: CodeEquity, PriceDate, LastPrice. To extract the
    last price for a number of equities on COMMON DATES I have used the
    query:

    select t.LastPrice,h1. LastPrice,h2.La stPrice,h3.Last Price from
    Blg_HistoricDat a t,Blg_HistoricD ata h1,Blg_Historic Data
    h2,Blg_Historic Data h3
    where t.CodeEquity=11 4151 and h1.CodeEquity=1 12220 and
    t.PriceDate=h1. PriceDate and h2.CodeEquity=1 12580 and
    t.PriceDate=h2. PriceDate and h3.CodeEquity=1 12228 and
    t.PriceDate=h3. PriceDate

    this works for about 20 self joined tables and then says syntax error.
    I'm wondering what sql limits it hits. Is it possible to do this in
    SQL for 300 tables?

    Thank you.
  • Gert-Jan Strik

    #2
    Re: sql server limit

    No, this is not possible for 300 tables, because the maximum number of
    tables in one SELECT statement is 255 (may be one more or less).

    With 20 tables, this should still work. You could try adding OPTION
    (ROBUST PLAN).

    Hope this helps,
    Gert-Jan

    bing wrote:[color=blue]
    >
    > I'm storing time series data in a table in SQL server 2000. The table
    > has columns like: CodeEquity, PriceDate, LastPrice. To extract the
    > last price for a number of equities on COMMON DATES I have used the
    > query:
    >
    > select t.LastPrice,h1. LastPrice,h2.La stPrice,h3.Last Price from
    > Blg_HistoricDat a t,Blg_HistoricD ata h1,Blg_Historic Data
    > h2,Blg_Historic Data h3
    > where t.CodeEquity=11 4151 and h1.CodeEquity=1 12220 and
    > t.PriceDate=h1. PriceDate and h2.CodeEquity=1 12580 and
    > t.PriceDate=h2. PriceDate and h3.CodeEquity=1 12228 and
    > t.PriceDate=h3. PriceDate
    >
    > this works for about 20 self joined tables and then says syntax error.
    > I'm wondering what sql limits it hits. Is it possible to do this in
    > SQL for 300 tables?
    >
    > Thank you.[/color]

    Comment

    Working...