[freetds] bcp timestamp trace
James K. Lowden
jklowden at schemamania.org
Wed Apr 7 01:49:52 EDT 2004
On Mon, 5 Apr, "Lowden, James K" <LowdenJK at bernstein.com> wrote:
> 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 spent a couple of hours looking at how to handle this.
Basically, we want to pretend the target table has no timestamp column,
and we want to ignore the timestamp data in the file. That's very similar
to what a bcp format file can do, IIRC. Trouble is, that code is
uncommented and, well, not as transparent as glass. And I can't seem to
find the format of bcp.fmt on Sybase's site.
The strategy I have in mind: when we read the table metadata from the
server, mark any timestamp column (user data type 0x50) as "do not load".
When building the bulk insert statement, exclude that column. When
reading the datafile, skip it, and do not allocate a field in the row
buffer for the data. It seems to me there should be some way to indicate
that a datafile column does not map to any column in the target table,
but, again, I didn't find a way.
So, Bill, when you read this, I'd be interested in your thoughts.
More information about the FreeTDS