| 
 Posted by Peter  Nofelt on 03/26/07 22:36 
Hi all, 
 
 
ISSUE: 
==================== 
In SQL 2005 (sp2) I get the following error when preforming a bulk 
insert with an associated xml format file: 
"Could not bulk insert. Unknown version of format file" 
 
Question: 
==================== 
I am unsure what they mean by "unknown version". Specifically the 
format file in question was created using bcp. Also the entire table 
scenario was created from a msdn example. 
 
Any ideas? have you seen this before? 
 
NOTE: i can reproduce this issue outside the example but will refer to 
msdn considering it is simple and easily reproducible. 
 
Scenario 
==================== 
I can reproduce this error with the BULK INSERT example discussed on 
msdn (example A) 
http://msdn2.microsoft.com/en-us/library/ms191234.aspx 
 
TO REPRODUCE: 
 
 * In short the table structure is: 
Person (Age int, FirstName varchar(20), LastName varchar(30)) 
 
* Data File Template: 
Age<tab>Firstname<tab>Lastname<return> 
 
* xml file format from bcp (and described on msdn) 
<?xml version="1.0"?> 
<BCPFORMAT 
xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
  <RECORD> 
    <FIELD ID="1" xsi:type="CharTerm" TERMINATOR="\t" 
      MAX_LENGTH="12"/> 
    <FIELD ID="2" xsi:type="CharTerm" TERMINATOR="\t" 
      MAX_LENGTH="20" COLLATION="SQL_Latin1_General_CP1_CI_AS"/> 
    <FIELD ID="3" xsi:type="CharTerm" TERMINATOR="\r\n" 
      MAX_LENGTH="30" 
      COLLATION="SQL_Latin1_General_CP1_CI_AS"/> 
  </RECORD> 
  <ROW> 
    <COLUMN SOURCE="1" NAME="age" xsi:type="SQLINT"/> 
    <COLUMN SOURCE="2" NAME="firstname" xsi:type="SQLVARYCHAR"/> 
    <COLUMN SOURCE="3" NAME="lastname" xsi:type="SQLVARYCHAR"/> 
  </ROW> 
</BCPFORMAT> 
 
* Here is some the actual sql statement that pulls this all together 
BULK INSERT mytestnames 
   FROM 'C:\datatest\exampledata-c.Dat' 
   WITH (FORMATFILE = 'C:\datatest\examplefmt.Fmt'); 
 
 
Thanks in advanced for any feedback. 
 
Cheers!
 
  
Navigation:
[Reply to this message] 
 |