自己对一个典型的formatFile格式进行了注释,方便以后查看。
<?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--This node is used for SSIS to locate records in bulk files, the sequences and ids of the fields here should exactly the same with data's physical position in files.-->
<RECORD xmlns="">
<FIELD ID="1" xsi:type="NativeFixed" LENGTH="4" />
<FIELD ID="2" xsi:type="NativeFixed" LENGTH="8" />
<FIELD ID="3" xsi:type="NativeFixed" LENGTH="8" />
<FIELD ID="4" xsi:type="NativeFixed" LENGTH="2" />
<FIELD ID="5" xsi:type="NativeFixed" LENGTH="1" />
<FIELD ID="6" xsi:type="NativeFixed" LENGTH="8" />
<FIELD ID="7" xsi:type="NativeFixed" LENGTH="8" />
<FIELD ID="8" xsi:type="NativeFixed" LENGTH="8" />
<FIELD ID="9" xsi:type="NativeFixed" LENGTH="8" />
<FIELD ID="10" xsi:type="NativeFixed" LENGTH="2" />
</RECORD>
<!--This node is used for describing the target table. The field ‘SOURCE’ is used to map with the RECORD/FIELD[ID], And the sequence of the COLUMN is used to do the data output, which should exactly the same sequence with the schema of the target table.-->
<ROW xmlns="">
<COLUMN SOURCE="1" NAME="ProfileID" xsi:type="SQLINT" />
<!--It tells us, “I am the 10th field in file, but the 2nd Column in table”-->
<COLUMN SOURCE="10" NAME="LeafBitmap" xsi:type="SQLSMALLINT" />
<COLUMN SOURCE="2" NAME="SegmentID" xsi:type="SQLBIGINT" />
<COLUMN SOURCE="4" NAME="Date" xsi:type="SQLSMALLINT" />
<COLUMN SOURCE="5" NAME="ItemCategoryID" xsi:type="SQLTINYINT" />
<COLUMN SOURCE="6" NAME="ItemID" xsi:type="SQLBIGINT" />
<COLUMN SOURCE="7" NAME="ActivityTotal" xsi:type="SQLBIGINT" />
<COLUMN SOURCE="8" NAME="SessionTotal" xsi:type="SQLBIGINT" />
<COLUMN SOURCE="9" NAME="SessionCarryTotal" xsi:type="SQLBIGINT" />
<COLUMN SOURCE="3" NAME="ParentItemId" xsi:type="SQLBIGINT" />
</ROW>
</BCPFORMAT>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--This node is used for SSIS to locate records in bulk files, the sequences and ids of the fields here should exactly the same with data's physical position in files.-->
<RECORD xmlns="">
<FIELD ID="1" xsi:type="NativeFixed" LENGTH="4" />
<FIELD ID="2" xsi:type="NativeFixed" LENGTH="8" />
<FIELD ID="3" xsi:type="NativeFixed" LENGTH="8" />
<FIELD ID="4" xsi:type="NativeFixed" LENGTH="2" />
<FIELD ID="5" xsi:type="NativeFixed" LENGTH="1" />
<FIELD ID="6" xsi:type="NativeFixed" LENGTH="8" />
<FIELD ID="7" xsi:type="NativeFixed" LENGTH="8" />
<FIELD ID="8" xsi:type="NativeFixed" LENGTH="8" />
<FIELD ID="9" xsi:type="NativeFixed" LENGTH="8" />
<FIELD ID="10" xsi:type="NativeFixed" LENGTH="2" />
</RECORD>
<!--This node is used for describing the target table. The field ‘SOURCE’ is used to map with the RECORD/FIELD[ID], And the sequence of the COLUMN is used to do the data output, which should exactly the same sequence with the schema of the target table.-->
<ROW xmlns="">
<COLUMN SOURCE="1" NAME="ProfileID" xsi:type="SQLINT" />
<!--It tells us, “I am the 10th field in file, but the 2nd Column in table”-->
<COLUMN SOURCE="10" NAME="LeafBitmap" xsi:type="SQLSMALLINT" />
<COLUMN SOURCE="2" NAME="SegmentID" xsi:type="SQLBIGINT" />
<COLUMN SOURCE="4" NAME="Date" xsi:type="SQLSMALLINT" />
<COLUMN SOURCE="5" NAME="ItemCategoryID" xsi:type="SQLTINYINT" />
<COLUMN SOURCE="6" NAME="ItemID" xsi:type="SQLBIGINT" />
<COLUMN SOURCE="7" NAME="ActivityTotal" xsi:type="SQLBIGINT" />
<COLUMN SOURCE="8" NAME="SessionTotal" xsi:type="SQLBIGINT" />
<COLUMN SOURCE="9" NAME="SessionCarryTotal" xsi:type="SQLBIGINT" />
<COLUMN SOURCE="3" NAME="ParentItemId" xsi:type="SQLBIGINT" />
</ROW>
</BCPFORMAT>