Toad World® Forums

Import wizard add column file name

I am working on an import script to import 6 excel files, all the same format with 4 tabs each into 4 different tables. I would like to include the name of the excel file as a column. So, I set up my tables first with a final column called “File Name”, nvarchar(max), and in the import I add a new column and select the file name option:

file_name.png

But when I run the script it doesn’t import any rows for this table. I get an error “encoding ‘System.Text.SBCSCodePageEncoding’ does not match the first file encoding ‘System.Text.UnicodeEncoding’. Import may fail.” in the log, but I also get that error for some other files without the file name column and all rows import correctly. Does anyone have any ideas as to why the file path would cause the data to not import? I removed this field to test and everything worked fine. Does this need to be a different format? I would think that nvarchar would work just fine.

It seems to work if you include added column to all files in a single import wizard. So it seems like any files you import within 1 import wizard activity have to identical in all ways. I also noticed that if you go edit the imports, the are all reset to the defaults, so for example, if you have files with 4 tabs, and you create an import for the 4th tab, if you go to edit, the wizard defaults to the first tab. Doesn’t seem like a good way to go. Can this be fixed?

What version of TDP are you using? I can edit first tab after I add import to 4th tab. Is that possible to send me your .tim template to take a look?

BTW. The message

"encoding ‘System.Text.SBCSCodePageEncoding’ does not match the first file encoding ‘System.Text.UnicodeEncoding’ is just warning message, it should not affect importing.