Skip to Content.
Sympa Menu

freetds - [freetds] bcp, for browse and flags

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO Frediano" <Frediano.Ziglio AT vodafoneomnitel.it>
  • To: "Freetds (E-mail)" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] bcp, for browse and flags
  • Date: Tue, 29 Apr 2003 11:10:30 +0200

I work a bit on column flags. Server send information from column to client.
I checked and updated these information including:
- column is a key
- column is writable
- column is an identity
- column is hidden
- column is nullable

TDS4.2 do not return many information (from a Sybase seem to return no
information...).
If FOR BROWSE clause is specified (ie SELECT * FROM table_name FOR BROWSE)
some additional (hidden) field are returned and flags like key and/or
identity are returned. These flags should be useful in bcp (to discover what
columns are keys).

If we have a table like (see also flags.c test in tds)

CREATE TABLE table_name
(
id NUMERIC(10,0) IDENTITY PRIMARY KEY, -- I used NUMERIC cause is
more portable
b VARCHAR(10) NULL,
c INT NOT NULL
)

And do a "SELECT c,b FROM table_name FOR BROWSE" 3 columns are returned
(TODO: do not show third column to client)
c: not nullable and writable (nullable not returned from TDS4.2)
b: nullable and writable (nullable not returned from TDS4.2)
id: writable, identity, key, hidden (some db do not return key for identity)

IMHO BCP should issue FOR BROWSE select and test if a column is key and/or
identity (these flags are valid in all version of TDS). However I don't know
how BCP should handle id/key fields... set identity_insert on ??? do not
insert these field assuming db generate it (perhaps we lost foreign key) ??

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page