SQLState=S1000, NativeError=0

I am trying to use the BCP command to execute the following statement, but I
keep getting the following error:

Starting copy...
SQLState = S1000, NativeError = 0
Error = [Microsoft][SQL Server Native Client 10.0]Unexpected EOF encountered
in
BCP data-file

0 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total     : 1

This is a very small XML file and here are it's contents:

<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
	xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
	xmlns:rs='urn:schemas-microsoft-com:rowset'
	xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
	<s:ElementType name='row' content='eltOnly'>
		<s:AttributeType name='c0' rs:name='WITHDRAWAL-CODE' rs:number='1'>
			<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='6' rs:
maybenull='false'/>
		</s:AttributeType>
		<s:AttributeType name='c1' rs:name='WITHDRAWAL-SDESC' rs:number='2' rs:
nullable='true'>
			<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='30'/>
		</s:AttributeType>
		<s:extends type='rs:rowbase'/>
	</s:ElementType>
</s:Schema>
<rs:data>
	<z:row c0='00' c1='00 Withdrawn pr'/>
	<z:row c0='01' c1='01 Change grade'/>
	<z:row c0='02' c1='02 Trans-pubSam'/>
	<z:row c0='03' c1='03 Trans-nonpub'/>
	<z:row c0='04' c1='04 Moved out of'/>
	<z:row c0='05' c1='05 Moved out of'/>
	<z:row c0='06' c1='06 Left-age wit'/>
	<z:row c0='07' c1='07 Left-age wit'/>
	<z:row c0='08' c1='08 Grad'/>
	<z:row c0='09' c1='09 Grad-met IEP'/>
	<z:row c0='11' c1='11 Died'/>
	<z:row c0='12' c1='12 Excused-disa'/>
	<z:row c0='13' c1='13 Commit to co'/>
	<z:row c0='14' c1='14 Withdrawn 15'/>
	<z:row c0='15' c1='Lft Marriage'/>
	<z:row c0='16' c1='16 Expelled'/>
	<z:row c0='17' c1='Left sch Pregna'/>
	<z:row c0='18' c1='18 Withdrawn no'/>
	<z:row c0='20' c1='20 Transfer did'/>
	<z:row c0='21' c1='21 EC Withdrawa'/>
	<z:row c0='22' c1='22 Entered care'/>
	<z:row c0='23' c1='23 Kindergarten'/>
	<z:row c0='24' c1='24 Homebound'/>
	<z:row c0='25' c1='25 EC eval only'/>
	<z:row c0='26' c1='26 EC withdrawa'/>
	<z:row c0='27' c1='27 EC transitio'/>
	<z:row c0='28' c1='Not eligile 3yr'/>
	<z:row c0='29' c1='Not elig for 3y'/>
	<z:row c0='30' c1='3yr elig not de'/>
	<z:row c0='31' c1='31 Left -social'/>
	<z:row c0='32' c1='32 Left - finan'/>
	<z:row c0='33' c1='33 Left - famil'/>
	<z:row c0='34' c1='34 Left-Unknown'/>
	<z:row c0='35' c1='35 Left-Over 21'/>
	<z:row c0='36' c1='enrol post seco'/>
	<z:row c0='37' c1='37 Left- to GED'/>
	<z:row c0='40' c1='40 EOY Enrolled'/>
	<z:row c0='41' c1='41 Dropped/ReEn'/>
	<z:row c0='42' c1='42  met loc gra'/>
	<z:row c0='50' c1='50 Special ed s'/>
	<z:row c0='60' c1='No Referal'/>
	<z:row c0='61' c1='Referal to SpEd'/>
	<z:row c0='62' c1='Refer HealthCar'/>
	<z:row c0='63' c1='Refer SpEd/Heal'/>
	<z:row c0='64' c1='Refer EC Progam'/>
	<z:row c0='65' c1='Refer Parent No'/>
	<z:row c0='97' c1='Displaced NonRe'/>
	<z:row c0='99' c1='99 Enrollment S'/>
	<z:row c0='WCV' c1='DO NOT USE'/>
	<z:row c0='YE' c1='DO NOT USE'/>
</rs:data>



</xml>

And this is my SQL table in the Development database which is currently empty:


CREATE TABLE wbl_Load (xCol xml);
GO

I am not using a format file but here is what I choose from the command
prompt:
"xml"
enter
\n\n\n

0
ironryan77
9/1/2010 4:03:50 PM
sqlserver.server 1327 articles. 0 followers. Follow

4 Replies
6179 Views

Similar Articles

[PageSpeed] 0

ironryan77 (u64030@uwe) writes:
> I am trying to use the BCP command to execute the following statement,
> but I keep getting the following error: 
> 
> Starting copy...
> SQLState = S1000, NativeError = 0
> Error = [Microsoft][SQL Server Native Client 10.0]Unexpected EOF
> encountered in 
> BCP data-file
> 
> 0 rows copied.
> Network packet size (bytes): 4096
> Clock Time (ms.) Total     : 1
>... 
> I am not using a format file but here is what I choose from the command
> prompt:
> "xml"
> enter
> \n\n\n
 
Two problems: you specify "xml" but that will probably be a binary type.
And if you accept the default for the prefix length you get a prefix > 0.
Prefix is only used with binary files, and you have a text file.

I played with this, but in a hurry, I could not compose a format
file that defines the entire field as a single file. Hm, well, 
you would specify </xml> as a terminator, but then the terminator
would not be imported. Bad idea.

I think you should look into OPENROWSET(BULK) and the SINGLE_CLOB
option. I'm in a hurry now, so I cannot give examples, but Books 
Online has information.


-- 
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

0
Erland
9/1/2010 10:09:35 PM
Thank you for this response, however, check this:
http://msdn.microsoft.com/en-us/library/ms190312.aspx

I would like to learn more about what you mean because the above link
recommends using SINGLE_BLOB.  Especially because I want to import this data
into an XML column and not a VARCHAR column.

Erland Sommarskog wrote:
>> I am trying to use the BCP command to execute the following statement,
>> but I keep getting the following error: 
>[quoted text clipped - 14 lines]
>> enter
>> \n\n\n
> 
>Two problems: you specify "xml" but that will probably be a binary type.
>And if you accept the default for the prefix length you get a prefix > 0.
>Prefix is only used with binary files, and you have a text file.
>
>I played with this, but in a hurry, I could not compose a format
>file that defines the entire field as a single file. Hm, well, 
>you would specify </xml> as a terminator, but then the terminator
>would not be imported. Bad idea.
>
>I think you should look into OPENROWSET(BULK) and the SINGLE_CLOB
>option. I'm in a hurry now, so I cannot give examples, but Books 
>Online has information.
>

-- 
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/201009/1

0
ironryan77
9/1/2010 11:41:56 PM
This was my BCP command:
bcp Development.dbo.wbl_Load in zSkywardEWCodes.xml -m50 -e ErrorLog -b100 -S
just5clicks.com -U###### -P######
and the "#"s represent my username and password

Erland Sommarskog wrote:
>> I am trying to use the BCP command to execute the following statement,
>> but I keep getting the following error: 
>[quoted text clipped - 14 lines]
>> enter
>> \n\n\n
> 
>Two problems: you specify "xml" but that will probably be a binary type.
>And if you accept the default for the prefix length you get a prefix > 0.
>Prefix is only used with binary files, and you have a text file.
>
>I played with this, but in a hurry, I could not compose a format
>file that defines the entire field as a single file. Hm, well, 
>you would specify </xml> as a terminator, but then the terminator
>would not be imported. Bad idea.
>
>I think you should look into OPENROWSET(BULK) and the SINGLE_CLOB
>option. I'm in a hurry now, so I cannot give examples, but Books 
>Online has information.
>

-- 
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/201009/1

0
ironryan77
9/1/2010 11:52:46 PM
ironryan77 via SQLMonster.com (u64030@uwe) writes:
> Thank you for this response, however, check this:
> http://msdn.microsoft.com/en-us/library/ms190312.aspx
> 
> I would like to learn more about what you mean because the above link 
> recommends using SINGLE_BLOB.  Especially because I want to import this
> data into an XML column and not a VARCHAR column. 


As I said, I was in a hurry, so I did not check Books Online. If it says
SINGLE_BLOB that is the way to go.


-- 
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

0
Erland
9/2/2010 9:39:46 PM
Reply:

Similar Artilces: