Skip to Content.
Sympa Menu

freetds - [freetds] How to apply Bulk Copy hints when using ctlib ?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Mark Songhurst <mark AT songhurst.org>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] How to apply Bulk Copy hints when using ctlib ?
  • Date: Thu, 3 Mar 2011 13:21:53 +0200

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




Archive powered by MHonArc 2.6.24.

Top of Page