Changes the default settings for various control parameters for a bulk copy between a file and SQL Server.
SqlBCPControl% ( sqlconn%, param%, value& )
where
SUCCEED (1) or FAIL (0).
SqlBCPControl% sets various control parameters for bulk-copy operations, including the number of errors allowed before ending an operation, the numbers of the first and last rows to copy, and the batch size.
These control parameters are meaningful only when you are copying between an operating-system file and a SQL Server table.
'Initialize bcp. Result% = SqlBCPInit%(Sqlconn%,"condb..address", "address.add", "addr.err", DBIN%) IF Result% = FAIL THEN SQLExit SQLWinExit End END IF 'Set the number of rows per batch. Result% = SqlBDPControl%(Sqlconn%, BCPBATCH%, 1000) IF Result% = FAIL THEN PRINT "SqlBCPControl% failed to set batching behavior." PRINT SQLExit SQLWinExit End END IF 'Set file column count. Result% = SQLBCPColumns%(Sqlconn%, 1) IF Result% = FAIL THEN PRINT "SqlBCPColumns% failed." PRINT SQLExit SQLWinExit End END IF 'Set file format. Result% = SqlBCPColfmt%(Sqlconn%, 1, 0, 0, -1, Chr$(13), 1, 1) IF Result% = FAIL THEN PRINT "SqlBCPColfmt% failed." PRINT SQLExit SQLWinExit End END IF 'Now, execute the bulk-copy. Result% = SqlBCPExec%(Sqlconn%, RowsCopied&) IF Result% = FAIL THEN PRINT "Incomplete bulk-copy. Only "; RowsCopied&; " rows copied." PRINT SQLExit SQLWinExit End END IF
SqlBCPColfmt%, SqlBCPColumns%, SqlBCPExec%, SqlBCPInit%