Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTS package invalid datatype conversion error 1

Status
Not open for further replies.

Kingkumar

Programmer
Jan 21, 2003
167
US
Hi,
I have a dts package to import the data from an excel file into the sql server table.
It was working fine until ihad this new sheet and now it has started throwing error
"TransformCopy 'DTSTransformation_1' conversion error: General conversion failure on column pair 1 (source column 'Agent SSN' (DBTYPE_WSTR), destination column 'Agent SSN' (DBTYPE_I8))"

i know it has soemthing to do with my data type in the excel sheet being text and the table datatype in sql is float but what i want to know is how to do the conversion that i dont need to change anything in the excel sheet.
thanks.
--king
 
Can all the data in the 'Agent SSN' be converted to float - what sort of values are in this field

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
Hi,
In the excel sheet teh data is the text format but the sql table the column has the datatype as float.
I can change for the time being but was wondering if some one is using hte package and doesnt want to do anything on the excel sheet is it possible to change the data type in the dts package instead of doing it in excel sheet
Also the other sheets are imported without anyproblem its only with this particular sheet its causing problem.
 
even thought the data in the excel sheet is stored as text do all the values meet the criteria of being float values:

a floating point number data from - 1.79E + 308 through 1.79E + 308

if not they will never go into a float datatype field.

You may want to change the table column in sql server to a more acceptable datatype ie varchar.

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
Thanks dbomrrsm,
i found the problem.
some of the values in that column were null thats why it was not able to do the conversion. by null i mean they ahd the value as 'NULL' it seems the excel file was result of osome query so....

One question is it possible to convert varchar to float in the table ?
 
as long as all the varchar values are convertable to float ie 'This is some text' wont convert but '1.92' should.

Code:
declare @text varchar (10)
set @text = 'This is some text'
select convert(float,@text)

declare @text1 varchar (10)
set @text1 = '1.92'
select convert(float,@text1)

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
runthe above as two seperate pieces of code in QA the second works

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top