Solved

BCP warning messages when outputing XML

Posted on 2006-07-07
3
1,208 Views
Last Modified: 2008-01-09
These warning messages are killing my processing time!

I am getting this warning message when running BCP within the SQL SERVER Query Analyzer FOR EVERY LINE CREATED!...

Starting copy...
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Warning: Server data (3046 bytes) exceeds host-file field length (0 bytes) for field (1).  Use prefix length, termination string, or a larger host-file field size.  Truncation cannot occur for BCP output files.

Now I realise this is just a warning message and comes about because of the -r option with the BCP command. I have seen this post http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_20546470.html

bcp "SELECT * FROM [dbo].[_CommunityStaging] FOR XML AUTO, ELEMENTS" queryout c:\temp\_CommunityStaging.txt -Scas074\cas074 -c -r -T

...but it really hits the processing time!

If I run the same command without the -r (row terminator) option...
bcp "SELECT * FROM [dbo].[_CommunityStaging] FOR XML AUTO, ELEMENTS" queryout c:\temp\_CommunityStaging.txt -Scas074\cas074 -c -T

... it runs in 10 seconds but does not form proper XML due to the carriage return it places into the code. When run the correct way (first example) it takes 2 minutes 38 seconds.

This is not going to scale up well when I perform the same request on many tables!

My question is: Is there a way to stop the warning messages coming through and therefore speed up the processing?

     If not is there a way to use another method to output the XML? I know osql is an option but this gives me an identifier at the begining of the file, loads of hyphens, and loads of spaces between XML. Completely useless to me.

Many thanks in anticipation

Dale
0
Comment
Question by:daletrotman
3 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 17062146
Consider writing a VB or .NET app to extract the Xml data.  It should not be more than 10 lines of code (depending on the number of parameters).
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 17631636
PAQed with no points refunded (of 500)

CetusMOD
Community Support Moderator
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question