HELP HELP Database Error - Microsoft SQL Native Client error '80040e07', Conversion failed when converting the nvarchar value 'Dave Smith' to data type int. /include/aspfunctions.asp, line 1243 ???

  • Error is displayed within the excel sheet the database has exported the data into. Only quater of the data that was selected is actually exported at at the top of the excel sheet the database has exported the data to I have an error Microsoft SQL Native Client error '80040e07', Conversion failed when converting the nvarchar value 'Dave Smith' to data type int. /include/aspfunctions.asp, line 1243 ???

    I have copied the following Code below the error is refering to :

    function db_query(sSQL,conn)

    dim asp_rs

    if IsIdentical(dDebug,true) then response.write sSQL & "

    "

    Set asp_rs = server.CreateObject("ADODB.Recordset")

    asp_rs.Open sSQL,conn // line 1243 for ref //

    call ReportError

    set db_query=asp_rs

    end function

    The database can export small sets of hundreads of records, but thousands I get this error. What is the issue.

  • the error is in the query you are creating, which you did not post.

    it looks like you are concatenating a number to a string . like CustomerID + ' ' + CustomerName and the result is one column is attempting to convert to an integer, instead of the integer columns converting to varchar, that you seem to expect.

    you will have to explictly convert to varchar, and columns that are not varchar, like this: CONVERT(varchar(20),CustomerID) + ' ' + CustomerName

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • ...

    The database can export small sets of hundreads of records, but thousands I get this error. What is the issue.

    The issue is reported to you: 'Dave Smith' cannot be converted to INT data type.

    I guess, that some records in your "thousands" have alpha-numeric values which cannot be converted to INT.

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • What would be the easy way to find this within my thousands of records, would you say?

  • Lucasprss (10/29/2012)


    What would be the easy way to find this within my thousands of records, would you say?

    the issue is not with your data.

    it's with the query you are using against your data.

    show us the query that was in the variable sSQL (called in function db_query(sSQL,conn))

    and we can show you how to fix the query you built.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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