How to validate column of SQL table structure before inserting data in SQL database

I have a csv file of 1000 rows, need to insert these data into SQL Database.
Now my concern is:

  1. How to Validate the length of data present in a Column of csv file to database table whose table lengh is fixed, for example create table asset
    (Asset ID int,
    AssetDetail varchar(100)
    Misc varchar(200)
    but the length of character in csv file is not fixed sometimes its value exceed i.e. more than 100 or 200 characters, so need to validate data before insert to database. Is it possible to do this? If possible then please share steps/workflow to do the same.
    Thanks in advance.
1 Like

It depends what you what you want to achieve…

I assume you have loaded the CSV into a data table…

If you just need to check that all values are within the given limit you could use:
dt.Columns(YourColumnIndex).MaxLength = YourLimit

In case of overflow (= some value is longer than YourLimit) the above will fail.
You could use Try Catch to handle that exception.


Thanks J0ska to reply.

I am fresher for UiPath, i didn’t get it, can you elaborate the same as workflow.
I want to first check the length of data in CSV and compare with the length of respective column in SQL. If CSV length greater than length of SQL table then display a message that “The input string length is bigger than the SQL table length, please delete some character.” and store this row number in a variable because there is 1000 number of row in CSV file. If CSV length is less than or equal to SQL table length then insert data to SQL table.

Please help to do the workflow like mentioned above.
Thanks in advance.


Hi all,

Can anyone help me for my concern? Please respond ASAP as i am at client side, a POC is going on and i have some deadlines here.