Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

BCP warning messages when outputing XML

Posted on 2006-07-07
3
Medium Priority
?
1,220 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

885 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