I would like to use SSIS to create database table flat file exports then import them in to variously distributed SQL Express installs. As you may guess, SSIS is not available in the Express version. When I do the bulk insert, it errors with:
Msg 4866, Level 16, State 8, Line 1
The bulk load failed. The column is too long in the data file for row 1, column 5. Verify that the field terminator and row terminator are specified correctly.
The generated file is ascii (1252) with char(09) (tab) between fields and char(0d) char(0a) ending a line (I think that is \r\n).
This is the format file (4th col is width of col):
9.0
5
1 SQLCHAR 0 12 "\t" 1 Record_ID ""
2 SQLCHAR 0 498 "\t" 2 Filename SQL Latin1 General CP1 CI AS
3 SQLCHAR 0 498 "\t" 3 Path SQL Latin1 General CP1 CI AS
4 SQLCHAR 0 12 "\t" 4 Width ""
5 SQLCHAR 0 12 "\r\n" 5 Height ""
The sample data starting from the top of the file:
Record_ID Filename Path Width Height
1437 BreadCakeCooknPie.eps G:\BakedGoods\BreadCakeCooknPie.eps 595 647
1438 CakeChocolateRoses.eps G:\BakedGoods\CakeChocolateRoses.eps 1200 848
I import it with the following T-SQL code:
bulk insert item_table from 'Item_Table.txt' with
( FORMATFILE='Item_Table.fmt', FIRSTROW=2)
The table fields are:
[Record_ID] [int] NULL,
[Filename] [nvarchar](249) NULL,
[Path] [nvarchar](249) NOT NULL,
[Width] [int] NULL,
[Height] [int] NULL
Any write-ups available? Any idea how to fix the error? Any idea how to grab the Format File created by SSIS? Any other ideas?
Thank you so much for considering my question.