Question on file loading to table
Moderators: chulett, rschirm, roy
Question on file loading to table
Hi,
I have a csv file reading using SeqFile stage. I have about 10 columns in csv file(eg. below) but the last two columns are decimals.
Here is Eg. my csv file
641,ABC,2009,10,ABCDEF,GHIJKLM,111,200,485262.93,336360.00
first 8 files are varchar files and last two are decimal fields i would like to read
but till the 9 field i was successful but 10 column, i couldnt able to read as decimal but could able to read it as varchar
Any idea, how I can read 10th column too as decimal.
Thanks
I have a csv file reading using SeqFile stage. I have about 10 columns in csv file(eg. below) but the last two columns are decimals.
Here is Eg. my csv file
641,ABC,2009,10,ABCDEF,GHIJKLM,111,200,485262.93,336360.00
first 8 files are varchar files and last two are decimal fields i would like to read
but till the 9 field i was successful but 10 column, i couldnt able to read as decimal but could able to read it as varchar
Any idea, how I can read 10th column too as decimal.
Thanks
I can use the type coversion but its not working. all 0's are being loaded into table in last columngssr wrote:As you read the column as Varchar, you can convert it using the Type conversion technique. Do you get the whole value as Varchar(Including the decimal value)?
Just let me know the format of stringtodecimal syntax, though its is clear in help, its not helping much.
Yes I can able to see records in veiwdata, with final column as varchar. But want to read as decimal.gssr wrote:Can you able to see the records in the sequential file ?. If not then check with the metadata you have mentioned and then we can go for the type conversion!!
I have another file, with two decimals which is at 7,8th positions, I was able to read as decimals and loaded successfully.
Only if the decimal column is at the end, there might be some rule to read as decimal. Just need that help
TRIED, but did not worked, still loading as zero's into table.gssr wrote:Then try to map the Varchar Column to Decimal without using any function to the target file. For your records your varchar(9) should be mapped to Decimal(6,2)
I do had a situation like you, and used the above solution which worked fine! (In 7x)![]()
Resolved, tried myselfpuliram wrote:TRIED, but did not worked, still loading as zero's into table.gssr wrote:Then try to map the Varchar Column to Decimal without using any function to the target file. For your records your varchar(9) should be mapped to Decimal(6,2)
I do had a situation like you, and used the above solution which worked fine! (In 7x)![]()
read as float
and then used function
DFloatToDecimal, it worked
Thanks