Importing/Exporting Data  «Prev 

Bulk insert statement in SQL Server - Format file

How a file should be formatted when inserting into SQL-Server database
How a file should be formatted when inserting into SQL-Server database

  1. 7.0 – The version of bcp program used.
  2. 9 – Number of fields in the file.
  3. column containing 1-9 – Order of the field in the file.
  4. column containing SQLCHAR – The host data type. It can be SQLCHAR, SQLNCHAR, SQLBINARY, SQLDATETIME, SQLDATETIM4, SQLDECIMAL, SQLNUMERIC, SQLFLT8, SQLFLT4, SQLINT, SQLSMALLINT, SQLTINYINT, SQLMONEY, SQLMONEY4, SQLBIT, SQLUNIQUEID, or SQLBINARY
  5. column containing 0 – The length of the column prefix, either 0, 1,2 or 4.
  6. Column containing 11, 40 … – The length of the field in the file.
  7. Column containing “” – The field terminator.
  8. Next column containing 1-9 – The order of the column in the table.
  9. Column containing au_id – Description column. This column usually contains the field name and cannot be blank.