Error when trying to link multiple tables

  • Hi,

    Please help me with the following query:

    It is giving this weird error giving me no idea where to start looking:

    Msg 248, Level 16, State 1, Line 1

    The conversion of the varchar value '110736663384' overflowed an int column. Maximum integer value exceeded.

    My query is as below:

    SELECT *

    FROM ((table1 AS t1 INNER JOIN table2 AS t2 ON

    t1.ID = t2.ID)

    INNER JOIN table3 AS t3

    ON t2.id2 = t3.id )

    Just a rough figures of records on the tables I have used.

    Table1 500 records

    Table2 > 210000 records

    Table3 > 300000 records

  • It's simple... one of the two columns you join on is an INT... the other is not and contains a number larger than what an INT can handle.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • donnelcyril (11/23/2008)


    Hi,

    Please help me with the following query:

    It is giving this weird error giving me no idea where to start looking:

    Msg 248, Level 16, State 1, Line 1

    The conversion of the varchar value '110736663384' overflowed an int column. Maximum integer value exceeded.

    My query is as below:

    SELECT *

    FROM ((table1 AS t1 INNER JOIN table2 AS t2 ON

    t1.ID = t2.ID)

    INNER JOIN table3 AS t3

    ON t2.id2 = t3.id )

    Just a rough figures of records on the tables I have used.

    Table1 500 records

    Table2 > 210000 records

    Table3 > 300000 records

    If it is just for display you can convert that particular field to number type

    kshitij kumar
    kshitij@krayknot.com
    www.krayknot.com

  • This is a cross-post with this http://www.sqlservercentral.com/Forums/Topic607251-149-1.aspx

    I'd suggest keeping discussion here.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

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