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 2008 Forums
 SSIS and Import/Export (2008)
 import text file with numeric

Author  Topic 

abenitez77
Yak Posting Veteran

53 Posts

Posted - 2011-03-31 : 15:00:31
I have a text field that uses | (vertical bar) as the field delimiter. It has numeric data and uses commas with periods (ie 168,324.00). I am having problems importing this text file. It does not like the commas and truncates the number to 168.32. How can I Import this? I tried importing into a table i created that has real type and I tried numeric type. Both don't work. I also have a column that has "010" in it and it truncates leading zeros because it puts it into a real column.


tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-03-31 : 15:17:23
If you need that formatting, then you'll need to use varchar data type as 010 will always get converted to 10 regardless of what numeric data type you select. Only varchar will preserve the formatting.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-04-01 : 05:32:07
If the numeric data has comma as part of it, you should use money datatype in the table

Madhivanan

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

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-04-01 : 12:34:56
Money won't work for "010".

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-04-05 : 06:29:03
quote:
Originally posted by tkizer

Money won't work for "010".

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog


Yes. But my answer was to the point "It has numeric data and uses commas with periods (ie 168,324.00)."

Madhivanan

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

- Advertisement -