Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

HELP HELP Database Error - Microsoft SQL Native Client error '80040e07', Conversion failed when converting the nvarchar value 'Dave Smith' to data type int.... Expand / Collapse
Author
Message
Posted Monday, October 29, 2012 5:24 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, November 16, 2012 5:03 AM
Points: 13, 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.
Post #1378196
Posted Monday, October 29, 2012 5:55 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 1:11 PM
Points: 12,905, Visits: 32,161
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

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1378204
Posted Monday, October 29, 2012 5:56 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 8:55 AM
Points: 2,873, Visits: 5,185

...
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!"
(So many miracle inventions provided by MS to us...)

How to post your question to get the best and quick help
Post #1378205
Posted Monday, October 29, 2012 6:55 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, November 16, 2012 5:03 AM
Points: 13, Visits: 23
What would be the easy way to find this within my thousands of records, would you say?
Post #1378231
Posted Monday, October 29, 2012 7:33 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 1:11 PM
Points: 12,905, Visits: 32,161
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

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1378246
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse