Issue in inserting data?

Hi @ All,

I have csv file, Am trying to import data to database.
It was showing this error
Let me know anyone solved


try to check if there is .toInt64

Hi @wija,

I already tried If i change anything in that csv file
{File is getting corrupting}
Actually that file I downloaded from website & performing some conditions after am trying to import data to database.

hmm file corrupting, then seems it’s the file faulty

HI @varunk

try saving the csv file again to an excel file. you can do this automatically as well through the Studio.

  1. Read CSV to read the file.
  2. Write Range to write the data into an excel

Then, try reading data from that to see whether it works. If its a problem with the CSV file, I believe this should fix it

Let know how it goes

Hi @Lahiru.Fernando,

No here we should not change that csv to excel
It is customer format from csv only we need to get the data & import in to database.

okay… One other option is to save the CSV file again to another CSV file. Just in case to make sure the file structure is correct. Did you try that as well?

Hi @Lahiru.Fernando,

Yeah I tried this as well,same error

How about this…

So seems you changed the data type in the CSV file. Can we try this…

  1. use a Read CSV activity to read the data in the csv file to a datatable.
  2. while you do the insert, try using the Int64.Parse(StringVariable) expression to convert the value to Int64

Did you try this?

Hi @Lahiru.Fernando,

I will check

Hi @Lahiru.Fernando,

Not working this also

the datatable that you will get from csv, try to use a for loop to convert the column which you want to a type of int as suggested by wija

use a if condition ito check if the column contains integer values in it, and then convert to integer type, try this logic and let us know if this helps,

Pavan H

To add to what @pavanh003 mentioned, you can try checking whether the data in the column can be converted to INT64 by using a TryParse command.

you can do this in a For Each Row loop.

  1. Within the loop. use a IF activity with below code
    Or if you have the value in a variable Then

This will return either a true or a false value based on whether it is able to convert the value or not.
If True, you can then do the conversion either by using the command @wija mentioned or:
you can use Int64.Parse(VariableName) to convert.

This will only convert if it is possible to convert. If not, it will not convert. I think this will suit you better…

Let know how it goes