Re: ISQL is truncating contents of text field sent to text file.



Rod (rod.perez@xxxxxxxxx) writes:
The text data is being generated on-the-fly using FOR XML by running
several Select statements in series (some headers and elements are
also sent to output). All these was compiled into a Stored Procedure
for modularity.

At first we were inserting each FOR XML to a table (SQL2k5)
only to find the solution won't run under SQL 2000, so we rolled back
to find a single solution compatible with SQL Server 2k & 2k5.

After asking on usenet, and being suggested to use BCP, we now
get a text-file including the output (w/o truncation) from the very
first Select statement inside the SP while the other Select statements
are ignored or not included in the text-file generated by BCP.

I would suggest that you are best off writing a client program that
receives the XML documents and writes them to file.

The alternative would be have one procedure per query and the have have a
command file that runs BCP once for each procedure, and at the end
concatenates the files into one with COPY. But I am a little wary
that BCP + FOR XML may not be something when always works. When first
asked, you only talked about a table column, why BCP appear to be a good
solution.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: BCP format file
    ... There is no way you can do this with BCP, ... use the bulk copy API and bulk from variables. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.tools)
  • Re: Nested Nodes in XML from a table
    ... > Thanks Erland, it works now. ... > extension, added the missing XML declaration line, SQL Server didn't ... > queries from SQL Server, but i rather create XML file and read from it ... but please look in Books Online. ...
    (comp.databases.ms-sqlserver)
  • Re: Help me with this query please.
    ... When I look at the examples for FOR XML EXPLICIT ... A more normal document would be: ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: BCP cant export more than MAX_INT rows
    ... Still it's odd in this age of BIGINTs that bcp can only count to 2.1 ... 1000 rows successfully bulk-copied to host-file. ... I really hope that this happened with 32-bit SQL Server? ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.tools)
  • Re: How to detect BCP success/fail in batch file?
    ... fails (failure caused by PK constraint), the value is the same, 0. ... However I realised that I might not be using the latest version of BCP ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.tools)