Insert into database

Hie guys.
I am inserting my excel file into a database. But there are some fields which are giving me errors for example Column names in excel which has spaces on the column name like High School, National Id Number etc. Column names without spaces are working fine

Hi @Tapiwa
I hope you are using Insert activity that would accept the datatable as input and the table name in database as another input…
make sure that the column names in both the excel and database table are same
and usually in database the column cannot be created with columnnames with space in between them, and so make sure that the excel columnname also should not have space in between,
And this error occurred due to mismatch of the column names buddy
Cheers @Tapiwa

Yep i am using insert activity. Is there any other way withought changing my excel column name because i scrap and write my excel here and there.

I hope only when the column names are same with datatable and the table columnnames in database are same, we can insert a datatable to a database table
well we can change the column name with simply a assign activity
like this (if the extracted datatable name is ExtractedDatatable)
then
ExtractedDatatable.Columns(“Yourpresentcolumnname”).ColumnName = "new columnname"
Cheers @Tapiwa

1 Like

Hey buddy. i used invoke code and used the query below
Dt.Columns(“High School”).ColumnName = “High_School”
Dt.Columns(“National Id”).ColumnName = “National_Id”. It worked
cheers @Palaniyappan

Excellent
Cheers @Tapiwa

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.