5. Populating Tables : Advanced Use of the Copy Statement : Considerations When Loading Large Objects : Considerations for Unformatted Copying a Large Object
 
Share this page                  
Considerations for Unformatted Copying a Large Object
The data file format is slightly different when you copy a large object using an unformatted copy.
The binary file has an extra byte after the end of the last segment of a nullable column. (A nullable column is one that was created with null). The length is not followed by a space character. The basic structure of a binary segment is:
integer2          = length of segment
char|byte(len)    = data
The last segment, or an empty object, is denoted by a zero length, followed (if the column is nullable) by a character indicating whether the column is null (=1) or not null (=0):
0        = length of segment
[byte(1) = 0 column is not null
           1 column is null]
Thus, a non-nullable column is segmented as:
length1 segment1 segment1 length2 segment2...lengthn segmentn0
A nullable column is segmented as:
length1 segment1 segment1 length2 segment2...lengthn segmentn0 0
                                                            ^
                                                        1 character
Empty and null strings appear as follows:
A non-nullable empty string consists solely of the zero integer length.
A nullable empty string consists solely of the end zeros: the zero integer length and the zero “not null” character indicator.
A null indicator consists of “01”: an end zero integer length and the null character indicator of “1.”