Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Problem export XLS to tabla

Author  Topic 

shifis
Posting Yak Master

157 Posts

Posted - 2008-12-03 : 21:21:16
Hi
I have a excel file that have a cell with information like these:
003
230
070
When I used the export of sql server 2005 to export this sheet to a sql table these information pass has:
3
230
70
What can I do to not lose the ceros

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-12-03 : 21:47:26
What datatype you used in SQL table?
Go to Top of Page

shifis
Posting Yak Master

157 Posts

Posted - 2008-12-03 : 22:21:40
I used char(3)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-04 : 08:23:00
it seems like the table columns data type is integer. if you want precedding 0's also make it as varchar
Go to Top of Page

LOOKUP_BI
Constraint Violating Yak Guru

295 Posts

Posted - 2008-12-04 : 17:01:21
Im not sure how far this is correct,but I created and excel sheet with the same data and mapped it to an ole db source.I tried setting the column to varchar for sql table .While executing I received an err msg "Cannot convert between unicode and non unicode".Therefore I changed the data type to nvarchar.It worked then !
Go to Top of Page

QAZAFI
Yak Posting Veteran

50 Posts

Posted - 2008-12-11 : 17:08:31
Just please try to use Nvarchar data type instead of varchar or char and It will get fixed
Many thanks
Syed
Go to Top of Page

QAZAFI
Yak Posting Veteran

50 Posts

Posted - 2008-12-11 : 17:12:04
it is because the data type of excel sheet in uniciode and u could not convert data between non unicode and unicode but u can change data type of excel column on going to advance editor as well
thanks
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-12-12 : 02:09:07
Format the cell to be Text before exporting data to it

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-12-12 : 20:20:33
You can add Data Conversion Task in Between task to resolve it.
Go to Top of Page
   

- Advertisement -