Hello,

I have a procedure that reads a table where each row contains the name of a text file to be imported into a Microsoft SQL server table. The problem is I don't ahead of time if the text file is Unicode or ANSI encoded. The 'BULK INSERT' command works fine in all cases. I would just like to know if there are any command parameters I can specify to suppress the diagnostic messages(listed below) generated by the command or if there is a way to verify how the text file is encoded???

If I leave the default DATAFILETYPE of 'char' and the text file has a Unicode signature, I get the following diagnostic message:
Bulk Insert: DataFileType was incorrectly specified as char. DataFileType will be assumed to be widechar because the data file has a Unicode signature.

If I specify a DATAFILETYPE of 'widechar' and the text file is ANSI encoded, I get the following diagnostic message:
Bulk Insert: DataFileType was incorrectly specified as widechar. DataFileType will be assumed to be char because the data file does not have a Unicode signature.

Below is an excerpt of the procedure:

CREATE TABLE ##TextFile (TextLine varchar(500) null)

BULK INSERT ##TextFile FROM '\D\Folder_Name\Text_Files\Import_File_Name.txt'

I have tried executing the command using CODEPAGE with the same results.

Please help.