[freetds] bcp text upload trace

Thompson, Bill D (London) bill_d_thompson at ml.com
Fri Jun 11 06:47:45 EDT 2004


Further to my last email, the tcpdump does not throw up anything much that
we didn't know before.

For bulkcopy to SQL server, TEXT data is being sent to SQL server in the way
that we previously understood and supported.
First we send a COLMETADATA/RESULTS message 0x81, where the text column is
described in the same way as any other column type.
Then we send a ROW message 0xd1, and the text data is formatted as any other
column type.

Two new things we didn't know before:

1) The client queries the server to see what level of bcp compatibility it
supports by exec-ing the undocumented stored procedure sp_bcp_dbcmptlevel
    On my SQL2K servers this returns "80". presumably bcp is backwards
compatible to SQL server 7 or 6.5 or 6.0
    I'd be interested to see a tcpdump when bcp is invoked with -V 6.5 (see

2) The client issues another undocumented procedure sp_tablecollations
'testdb..text_test' to get the SQL server description of the collations in
the table.
    This is used to build the "insert bulk" statement . I guess we may find
doing this useful here, or elsewhere...


> -----Original Message-----
> From:	Lowden, James K [SMTP:LowdenJK at bernstein.com]
> Sent:	10 June 2004 21:57
> To:	TDS Development Group
> Subject:	[freetds] bcp text upload trace
> Our BCP implementation doesn't do TEXT columns.  Neither does it complain;
> it just hangs because the server doesn't respond.  
> For your enjoyment, attached is tcpdump output of an upload to a table
> having a single column, of type TEXT.  The tools used were:
> $ bcp -v
> BCP - Bulk Copy Program for Microsoft SQL Server.
> Copyright (c) 1991-1998, Microsoft Corp. All Rights Reserved.
> Version: 7.00.623
> $ isql -E -Smpquant -Q"select @@version"
>         --------------------------------
>  Microsoft SQL Server  2000 - 8.00.818 (Intel X86)
>         May 31 2003 16:08:15
>         Copyright (c) 1988-2003 Microsoft Corporation
>         Enterprise Edition on Windows
>          NT 5.0 (Build 2195: Service Pack 3)
> and
> $ windump -w textbcp.tcpdump -xX -s1500 tcp and host mpquant and port 2500
> and host ntc0272
> I thought perhaps we could at least decode what's going on.  That would
> make it easier to add the functionality.  
> Thank you for your kind attention.  
> --jkl
>  <<textbcp.tcpdump.upload.text>> 
> -----------------------------------------
> The information contained in this transmission may contain privileged and
> confidential information and is intended only for the use of the person(s)
> named above. If you are not the intended recipient, or an employee or
> agent responsible for delivering this message to the intended recipient,
> any review, dissemination, distribution or duplication of this
> communication is strictly prohibited. If you are not the intended
> recipient, please contact the sender immediately by reply e-mail and
> destroy all copies of the original message. Please note that we do not
> accept account orders and/or instructions by e-mail, and therefore will
> not be responsible for carrying out such orders and/or instructions.
> If you, as the intended recipient of this message, the purpose of which is
> to inform and update our clients, prospects and consultants of
> developments relating to our services and products, would not like to
> receive further e-mail correspondence from the sender, please "reply" to
> the sender indicating your wishes.  In the U.S.: 1345 Avenue of the
> Americas, New York, NY 10105.
>  << File: textbcp.tcpdump.upload.text >>  << File: ATT2247823.txt >> 


If you are not an intended recipient of this e-mail, please notify
the sender, delete it and do not read, act upon, print, disclose,
copy, retain or redistribute it.

Click here for important additional terms relating to this e-mail.


More information about the FreeTDS mailing list