Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2003
    Posts
    8

    Question Unanswered: Arithmetic overflow error converting expression to data type int.

    I've got this error message while generate the output with ASP:

    "Microsoft OLE DB Provider for SQL Server (0x80004005)
    Arithmetic overflow error converting expression to data type int."

    it indicate that the error is related to this line:
    "rc1.Movenext"

    where rc1 is set as objconn.Execute(sql).

    Not all outputs result like this, it happens when it has many relationships with other records, especially with those records which also have many relationships with other records.

    Can anyone suggest a solution?
    I've tried to increase the size of the database file, but it doesn't work.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    could you perhaps show the query that caused the error?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2003
    Posts
    8

    Here is the query

    Here is the query:


    CREATE procedure rp_co_relatedcompanies @companyregistrationno varchar(20)
    as
    set nocount on
    --used for related companies details


    select a.companypersonid,a.personname,a.personaddress1,a. personaddress2,a.personcity,a.personstate,a.person country,
    a.personzip,a.personphone,a.personfax,a.personemai l,a.personuniqueid,b.principalbusiness,b.secondryb usiness,
    c.relationwithcompany,c.numberofshares, c.classofsharesheld , cast(d.noofissuedshares as int) 'noofissuedshares',
    'percentageofsharehold' = case when c.numberofshares =0 then 0 else c.numberofshares/d.noofissuedshares*100 end, c.otherremarks
    from companyperson a
    left join companystructure d on a.personuniqueid=d.companyregistrationno
    left outer join operationsandactivity b on a.personuniqueid = b.companyregistrationno
    left outer join relationshipcompanyperson c on a.companypersonid = c.companypersonid
    where c.companyregistrationno = @companyregistrationno and c.relationshipwith = 2
    and a.deletionflag=0 order by a.personname
    set nocount off
    GO

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    can you see anything in that query where there might be a problem "converting expression to data type int"

    the immediate suspect is cast(d.noofissuedshares as int)

    another suspect is c.numberofshares/d.noofissuedshares*100

    check those and let us know
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Table DDL would help a lot. Heck, I was betting on the c.companyregistrationno being an INT and the @companyregistrationno failing the implicit Cast...

    Anybody want to start a pool on this? Or another option (not as much fun, but the problem would get solved a lot faster) would be for yllas to post the DDL for all of the tables in this query!

    -PatP

Posting Permissions

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