• The sample data you posted is not fixed length, but I will have to assume that there were accidents when you pasted into the web form.

    Your format file should look something like this:

    10.0

    12

    1 SQLCHAR 0 10 "" 1 Machine Latin1_General_CI_AS

    2 SQLCHAR 0 20 "" 2 Job Latin1_General_CI_AS

    ...

    11 SQLCHAR 0 5 "" 11 PiecesFed Latin1_General_CI_AS

    12 SQLCHAR 0 0 "\r" 0 "" ""

    The first line is the version number of the format-file format. 10.0 is SQL 2008.

    12 is the number of fields. You have 11, and I've added one extra for end-of-line.

    The following lines are description of the file fields. The first column is the field number. The second is the data type, which is always SQLCHAR since this is a text file. (Or SQLNCHAR for a Unicode file.) The third should always be 0 for a text file. The fourth column is the field length, and here you provide your field widths. (Note that you need to double if you have a Unicode file.) The fifth column is the terminator, which you have none but at end of line. (For a Unicode file it should be \r\0\0.)

    The sixth column is the target column in the database table, starting on 1. 0 means don't import. The seventh is the column name, but this is only informational. The last is the collation, which matters if there is non-ASCII data in the file.

    I see a problem, your dates are formatted as

    03/03/201014:56:30 and

    Wed Mar 03 14:47:03 2010

    None of those format will convert to datetime, so you would need to import them as strings and then parse them. Quite messy.

    For this reason, I think a lot easier solution is to go back to the C#. This article on my web site shows how you can stream a file to a table-valued parameter:

    http://www.sommarskog.se/arrays-in-sql-2008.html.

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]