dbTalk Databases Forums  

type problem of data transition between sqlserver and excel

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss type problem of data transition between sqlserver and excel in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
fairyvoice
 
Posts: n/a

Default type problem of data transition between sqlserver and excel - 06-17-2009 , 01:36 AM






Hi, I encounter a problem when doing some data transition work from excel to
sql server, there is a column in the excel sheet in which most contents are
integer but still some are words, after the transition I found in the
coresponding table of sql that the rows whose value is not integer in excel
are set as null, seems the excel treat the column as int type so the words
are omitted, I tried to change the class of cell into "text" the column's
property the still the same thing happens. I tried both DTS in sqlserver and
write c# code through OleDb to do this job and got the same result. I just
want get the values as varchars with non-integer ones reserved. What should I
do ?

p.s in some test I tried I found that if a column contains mostly alphabet
words and few integers , the integers will be set as null after the
transitions, so looks like the excel will give the column a type according to
the type of its most rows. All I want to to get all the values as varchars,
please helpl, thanks

Reply With Quote
  #2  
Old   
Todd C
 
Posts: n/a

Default RE: type problem of data transition between sqlserver and excel - 06-17-2009 , 07:29 AM






SSIS treats Excel data with contempt. It is one of the biggest flaws of SSIS,
as far as I am concerned.

Try using an OLE Db connector for Jet 4.0 (NOT an Excel Connection Manager).
In there you can specify properties. Specify the Extended Properties as
"Excel 8.0;IMEX=1;HDR=Yes"

The IMEX=1 setting tells Excel to read all 'intermixed' columns as text.

HTH
=====
Todd C


"fairyvoice" wrote:

Quote:
Hi, I encounter a problem when doing some data transition work from excel to
sql server, there is a column in the excel sheet in which most contents are
integer but still some are words, after the transition I found in the
coresponding table of sql that the rows whose value is not integer in excel
are set as null, seems the excel treat the column as int type so the words
are omitted, I tried to change the class of cell into "text" the column's
property the still the same thing happens. I tried both DTS in sqlserver and
write c# code through OleDb to do this job and got the same result. I just
want get the values as varchars with non-integer ones reserved. What should I
do ?

p.s in some test I tried I found that if a column contains mostly alphabet
words and few integers , the integers will be set as null after the
transitions, so looks like the excel will give the column a type according to
the type of its most rows. All I want to to get all the values as varchars,
please helpl, thanks

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.