SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


HELP HELP Database Error - Microsoft SQL Native Client error '80040e07', Conversion failed when...


HELP HELP Database Error - Microsoft SQL Native Client error '80040e07', Conversion failed when converting the nvarchar value 'Dave Smith' to data type int....

Author
Message
Lucasprss
Lucasprss
Valued Member
Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)

Group: General Forum Members
Points: 51 Visits: 23
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.
Lowell
Lowell
SSC Guru
SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)

Group: General Forum Members
Points: 71440 Visits: 40930
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!
Eugene Elutin
Eugene Elutin
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12362 Visits: 5478

...
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
Lucasprss
Lucasprss
Valued Member
Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)

Group: General Forum Members
Points: 51 Visits: 23
What would be the easy way to find this within my thousands of records, would you say?
Lowell
Lowell
SSC Guru
SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)SSC Guru (71K reputation)

Group: General Forum Members
Points: 71440 Visits: 40930
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!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search