Solved

BCP warning messages when outputing XML

Posted on 2006-07-07
3
1,206 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
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…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now