How to apply Bulk Copy hints when using ctlib ?

Mark Songhurst <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
Hello,
I'm using FreeTDS 0.82 on Linux RedHat Enterprise 4.0 x64. My database
is MS SQL Server 2008 Standard Edition.
I'm programming in C and using the ctlib API of FreeTDS.

My program is successfully performing bulk copies into the database,
but the problem I have is that when the data is being inserting into a
table, the constraint for that table is being disabled. Once the bulk
copy is complete the constraint remains disabled.

I need the constraint active during the bulk copy to ensure bad data
is rejected (it's ok for the whole bulk copy to fail if only one data
item is bad).

I can see support for keeping constraints enabled in the dblib API for
FreeTDS - there is a bcp_options function which supports a BCPHINTS
value of CHECK_CONSTRAINTS - as documented here:
http://freetds.schemamania.org/reference/a00286.html#ga6

Please can you suggest how I can keep constraints enabled during a
bulk copy using the ctlib API?


Many thanks,
Mark Songhurst
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.