[freetds] bcp timestamp trace

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Tue Apr 6 04:04:13 EDT 2004


> 
> Attached for future reference is a perfect tcpdump trace of a 
> short session using BCP.EXE to load four rows into a 
> Microsoft SQL Server 7.0 table.  
> 
> Notes:
> 
> 1.  To get the metadata, does:
> 	SET FMTONLY ON
> 	select * from dbname..tablename
> 	SET FMTONLY OFF
>     Might be more efficient than "where 0=1".  
> 
> 2.  "insert bulk dbname..tablename (ts int)".  
> 
> The DDL for the table:
> 
> 	CREATE TABLE ts (ts int, cc timestamp)
> 
> So (in contradiction to comments I just committed), the 
> timestamp column is simply omitted from the query.  I guess 
> the server does the magic.  
> 

Interesting.
About comment in bcp

/**
 * \todo support timestamp columns.
 * Things we know: 
 *  1. usertype is 80 (0x50)
 *  2. server type is 183 (0xAD)
 *  3. Microsoft bcp.exe (TDS 7.0) uses SQL type "INT" in the bulk
insert statement.
 *  4. Library must send null; server sets timestamp on receipt.
 *  5. FreeTDS will send null if data_size = -1.
 *  6. Something is munging the server type from 183 to 179.  
 */

2   it's binary (in this case XSYBBINARY, Sybase send SYBBINARY)
3,4 this is false, table was CREATE TABLE ts (ts int, cc timestamp), bcp
just to not send timestamp column (filled by server)
6   I don't understand...

freddy77



More information about the FreeTDS mailing list