ERROR!The query and the views in it exceed the limit of 256 tables

  • I am a new user of SQL Server. I have the operating system window XP Professional Edition and installed SQL Server 2000.

    In SQL Server i have six view of different six companies respectively while these views have the same column named (Prod_ID, Prod_Name and Total_Year_2004). I want to create a view which shows the total sale of the company product wise. I write the query for this purpose It creates the view but when executed it display the subject error message. Please help me how to fix it.

    Thanks

    BASIT

  • Basit, unfortunately, without seeing the code we cannot help much.  Can you please post the code for review?



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • ...not only the code, but also the error message you've indicated in the subject.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Dear AJ Ahrens and Frank!

    The code i wrote for it is as follows:

    in this query one table named (OUT_OIL_ENE_PROD) and six views used.

    //**CREATE VIEW V_2_5_P1

    AS

    SELECT [OUT_OIL_ENE_PROD].ref_out_id,

    [OUT_OIL_ENE_PROD].energy_prod,

    (SELECT

    SUM(A.ton_year_1+B.ton_year_1+C.ton_year_1+D.ton_year_1+E.ton_year_1+F.ton_year_1)

    FROM [V_2_5_1_P2] A,[V_2_5_2_P2] B,[V_2_5_3_P2] C,[V_2_5_4_P2]

    D,[V_2_5_5_P2] E,[V_2_5_6_P2] F

    WHERE A.ref_out_id = [OUT_OIL_ENE_PROD].ref_out_id

    AND B.ref_out_id = [OUT_OIL_ENE_PROD].ref_out_id

    AND C.ref_out_id = [OUT_OIL_ENE_PROD].ref_out_id

    AND D.ref_out_id = [OUT_OIL_ENE_PROD].ref_out_id

    AND E.ref_out_id = [OUT_OIL_ENE_PROD].ref_out_id

    AND F.ref_out_id = [OUT_OIL_ENE_PROD].ref_out_id ) AS ton_YEAR_1

    FROM OUT_OIL_ENE_PROD**//

  • Hm, this doesn't indicate some error. You haven't posted the error message you get and can you also provide the information reqeusted here: http://www.aspfaq.com/etiquette.asp?id=5006

    Another thing is, be explicite in your JOIN and refrain from doing this in your WHERE clause.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • The DDL is critical here, especially since you say this view references 6 other views. If you're nesting views like that, you're going to have to look at the referenced view definitions and see what views/tables they refer to, so on down the line.

    K. Brian Kelley
    @kbriankelley

Viewing 6 posts - 1 through 5 (of 5 total)

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