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
 SQL Server Administration (2005)
 exponent problem with csv file

Author  Topic 

aakcse
Aged Yak Warrior

570 Posts

Posted - 2009-07-13 : 07:52:55
Hi All,

I am facing a problem with csv file column inv containing
data like 100000000000 (column taken as string DT_STR size 250 in ssis) in table it is coming as 1.00 E + 11
how ever I want it as 100000000000, as in raw file.

There are 49 such file and I am using for each loop counter to upload
there are few such records in all of the source file.


kindly help

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-07-13 : 08:03:24
What datatype are you tring to insert this value into?
Go to Top of Page

aakcse
Aged Yak Warrior

570 Posts

Posted - 2009-07-13 : 08:25:01
varchar(250)
Go to Top of Page

aakcse
Aged Yak Warrior

570 Posts

Posted - 2009-07-13 : 08:55:57
any updates on this, do I need to import it to access and then reimport to using ssis..however this will take time..
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-07-13 : 09:20:39
Sorry, been busy working for a living. How are you importing it currently? However you are doing it is trying to convert it to a float, so you may need to convert it implicitly or if you are using BCP, use a format file.
Go to Top of Page

aakcse
Aged Yak Warrior

570 Posts

Posted - 2009-07-13 : 09:21:50
I found the below after googling, however how to add the tab char in csv file.. plz help..lets give a try to this,, I have tried importing it into text field, no gain..

I've come up with a sort of a work-around for the issue of Excel
converting text fields in a CSV file to an exponential number when you
open it without going through the text import wizard.

If you append a tab character (ASCII 9) to the end of the field, right
before the comma, Excel will import the field as text. You still have
a tab character at the end of the field, but you can't see it. If you
cursor past it in the edit bar, you have to press the cursor key to
get past it twice and if you copy and paste the field into a text
editor, the tab will come with it. But if all you want to do is look
at it, there isn't a problem.

I've tried this only with Excel 2003.
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-07-13 : 09:51:04
You have to do this manually. Why are you even going near Excel?

You didn't answer my question. How are you importing the data? What method are you using to get the CSV file into SQL Server?
Go to Top of Page

aakcse
Aged Yak Warrior

570 Posts

Posted - 2009-07-13 : 09:54:58
I am using SSIS for import.
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-07-13 : 11:09:27
Do you need to use SSIS? i.e. are you doing anything else with the data, or could you just use BULK INSERT to get the data into a table?

Also, you could run an OPENROWSET query to get the data from the CSV and still use SSIS? Othwise you neeed to convert that field to the length you want it.
Go to Top of Page
   

- Advertisement -