Has anyone else had a problem when querying a CSV file that small negative numbers return as zero? Or truncating values in particular columns?
I have a CSV file that has a column with mostly zeroes in it, with the occasional small negative decimal (ie. -0.15). When I do a Sum of that column, the result comes back 0. When I query the whole table and look a the specific location where I know there should be a small negative value, the result is still 0.
Other columns in the CSV have positive and negative decimal numbers and they all work fine. When I change the small negative decimal in the column in question to something bigger (ie. -10.15), the result I get is 10.
I am baffled as to how/why I am getting truncated numbers in just one column.
Andrew T.
CSV Query Problem
Moderators: Dorian (MJT support), JRL
Re: CSV Query Problem
***SOLVED***
The answer is to use a Schema file. I believe that CSV queries without schema files default to the format of the first line of data. Since the first row of the column in question was 0, and not 0.00, the default became integer instead of decimal.
Andrew T
The answer is to use a Schema file. I believe that CSV queries without schema files default to the format of the first line of data. Since the first row of the column in question was 0, and not 0.00, the default became integer instead of decimal.
Andrew T
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: CSV Query Problem
Glad you sussed it. Using schema files was discussed here:
https://www.mjtnet.com/blog/2010/01/28/ ... s-as-text/
https://www.mjtnet.com/blog/2010/01/28/ ... s-as-text/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?