BCP support for initialization strings

You can now use the bcp command to send Transact-SQL commands, such as set replication off, to Adaptive Server before data is transferred.

Although you can use any Transact-SQL command as an initialization string for bcp, you must reset possible permanent changes to the server configuration after running BCP. You can, for example, reset changes in a separate isql session.

bcp syntax changes

The following BCP parameter is included to support Transact-SQL initialization commands:

-- initstring “Transact-SQL command

NoteResult sets issued by the initialization string are silently ignored, unless any error occurs.

Example

In the following example, replication is disabled when titles.txt data is transferred into the pubs2 titles table:

bcp pubs2..titles in titles.txt –-initstring “set replication off” 

NoteBecause the set replication off command in this example is limited to the current session in Adaptive Server, there is no need to explicitly reset the configuration option after BCP is finished.

NoteIf Adaptive Server returns an error, BCP stops the data transfer and displays an error message.