Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Data integrity: defaults, rules, and triggers [Table of Contents] Rules and triggers

Utility Guide

[-] Chapter 3 Using bcp to Transfer Data to and from Adaptive Server
[-] Data integrity: defaults, rules, and triggers
[-] Defaults and datatypes

Defaults and datatypes

When copying data into a table, bcp observes any defaults defined for the columns and datatypes. That is, if there is a null field in the data in a file, bcp loads the default value instead of the null value during the copy.

For example, here are two rows in a file to be loaded into authors:

409-56-7008,Bennet,David,415 658-9932,622 Pine St.,Berkeley,CA,USA,94705213-46-8915,Green,Marjorie,,309 63rd St. #411,Oakland,CA,USA,94618

Commas separate the fields; a newline terminator separates the rows. There is no phone number for Marjorie Green. Because the phone column of the authors table has a default of "unknown," the rows in the loaded table look like this:

409-56-7008  Bennet  David 415 658-9932  622 Pine St.
    Berkeley  CA  USA  94705
213-46-8915  Green   Marjorie  unknown       309 63rd St. #411
    Oakland   CA  USA  94618


Data integrity: defaults, rules, and triggers [Table of Contents] Rules and triggers