Initiates an incremental table transfer.
transfer table [[db.]owner.]table [to | from] destination_file [ for { ase | bcp | iq | csv } ] [ with {column_separator=string}, {column_order=option}, {encryption=option}, {row_separator=string}, {resend=id}, {progress=sss}, {tracking_id=nnn} {sync = true | false]}, {fixed_length = true | false} , null_byte = true | false}]
column_order=option (does not apply to a load using for ase; reserved for future use)
column_separator=string (does not apply to a load using for ase; reserved for future use)
encryption={true | false} (does not apply to a load using for ase; reserved for future use)
progress=nnn
row_separator=string (does not apply to a load using for ase; reserved for future use)
The SAP ASE server removes a destination file if all these conditions apply:
The file is a regular file, not a named pipe, symbolic link, or other special file.
The SAP ASE server opens the file as part of this transfer.
The transfer fails, or sends no rows.
ase – a format for importing data into the SAP ASE server. This output format is a licensed feature, available to RAP customers and to customers with licenses for in-memory databases. No data transformations are applied. This file format includes a header that describes the table, including the source computer’s byte order, character set, and default sort order. This is the default value for tables that have had no successful prior transfers.
bcp – a format for importing data as bcp binary-formatted data. Rows are output as binary data that can be loaded using bcp. No data transformations are applied. As part of the transfer, the SAP ASE server creates a format file that bcp uses to describe the data and appears in the same directory as the output file.
You cannot use for bcp to transfer to a named pipe.
{table_name},{database_id},{object_id}.fmt
0 if the column is not null
1 if the column is null
Non-nullable data does not include this null byte (see IQ’s documentation for load table). Variable-length strings are preceded by one or two bytes indicating the length of the string, where the number of prefix bytes is determined by the column’s maximum length: one byte for strings up to 255 bytes, or two bytes for strings 256 bytes or longer (SAP ASE supports strings up to about 16000 bytes). Except for strings, every column is transmitted as a fixed width, padded if necessary to expand it to this fixed-width size.
with fixed_length='true' – all columns, including strings, are padded to their full width. Strings are padded with blanks; other columns are padded with <NUL> or 0x00. No column has a length indicator
with null_byte='true' – all columns must have a null byte, whether or not the column is nullable. This qualifier forces for iq to use the fixed_length='true’ modifier, regardless of what the command specifies
csv – a format of character-coded values. Rows are output as character-coded data. Columns are separated by a designated column separator, and rows are terminated by a designated row terminator. Separators and terminators are user-defined.
id – order by column ID, as given in syscolumns. This is the only acceptable column order when the transfer is for bcp, and is the default value for those transfers.
name – order by column name as given in syscolumns, using the SAP ASE server’s current character set and sort order.
name_utf8 – order by column name as given in syscolumns, translating the column name to UTF8 characters before sorting.
offset – order by column offset within the data row. This is the only acceptable column order when the transfer is for ase, and is the default value for those transfers.
for ase – use the offset column order
for bcp – use the id column order
true – decrypt columns before transmission. This is the default value. The user must have permission to decrypt any encrypted columns.
false – transmit columns encrypted exactly as they appear in the data row.
The SAP ASE server selects the indicated entry’s starting timestamp as the starting timestamp for this transfer, and the indicated entry’s destination type (ase, bcp, and so on) as the transfer’s default destination type.
Negative values for id retrieve history entries for previously completed successful transfers of the specified table. -1 names the most recently complete successful transfer, -2 the next most recent, and so forth. The transfer history table stores entries for both successful and failed transfers.
select end_code, sequence_id, pathname from spt_TableTransfer where id = object_id('mytable') and tracking_id = 123
The SAP ASE server does not control the tracking_id or require that it be unique.
true – the transfer is synchronized so that rows from the table included in the transfer are captured as a group. transfer waits until all transactions affecting this table end before it starts. New transactions that affect this table cannot modify the table while transfer waits to start. Instead, they wait until transfer begins. While transfer is in progress, transactions cannot modify rows in this table until they are inspected by transfer.
false – the transfer is not synchronized. transfer sends rows that are within the selected timestamp range, regardless of whether it can send other rows from the table. This is the default behavior.
true – the SAP ASE server pads strings to their full width instead of using a prefix length.
false – the SAP ASE server sends the string using the default behavior—sending the string with the prefix length.
true – the SAP ASE server includes a null byte at the end of all columns—0 if the column is null, 1 if it is not—whether or not the column is nullable. true forces for iq to use the fixed_length='true’ modifier, regardless of what you specified with the transfer command.
false – the SAP ASE server provides a null byte only for nullable columns.
grant transfer table on mytable to john
transfer table mytable to '/path/to/file' for iq with column_order = 'name_utf8'
transfer table mytable to '/path/to/file3/'for ase with resend=10
The example changes the default column order for a for ase transfer. After the transfer, the default receiver is ase, the column order is offset, and column and row separators are null.
transfer table sends only committed data that has changed since the previous transfer.
The string argument to column_separator and row_separator in the with clause may be up to 64 bytes long, and may contain formatting instructions:
“\b”indicates a backspace, <BS> (Ctrl+H).
“\n” indicates a newline, <LF> (Ctrl+J).
“\r” indicates a carriage return, <CR> (Ctrl+M).
“\t” indicates a <TAB> (Ctrl+I).
“\\” indicates a backslash.
Any “\” in the string that is not part of one of these sequences is an actual backslash, and appears as such in the string.
transfer table .. from does not fire triggers during updates or inserts.
Msg 2633, Level 20, State 1 Server 'SYB155', Line 1 TRANSFER TABLE failed to insert a row to table 'my_tab'. The indicated error was 2601. Msg 16025, Level 16, State 1 Server 'SYB155', Line 1 TRANSFER TABLE my_tab: command failed with status 2633.To retrieve the error message, manually query master..sysmessages. For example, if 2601 is your error number, enter:
select * from master..sysmessages where error = 2601See the Troubleshooting Guide for more information about error 2601.
Not all rows are always transferred. If a user updates the table while the transfer is in progress, the updated rows may not be transferred.
The transfer is not incremental; you can transfer only the entire table, and later transfers are not notified of this transfer.
No history entry is written to spt_TableTransfer. The transfer appears in monTableTransfer for the duration of the transfer, but once the transfer is complete the record vanishes.
Permission to transfer a table does not automatically grant permission to decrypt data within that table. To decrypt any encrypted columns, you must gain specific permission from the table owner.
The following describes permission checks for transfer table that differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must be the table owner or a user with tranfer table permission on the table. |
Disabled | With granular permissions disabled, you must be the table owner, be a user with transfer table permission, or a user with sa_role. |
Values in event and extrainfo columns of sysaudits are:
Information | Values |
---|---|
Event | 136 |
Audit option | transfer table |
Command or access audited | transfer table |
Information in extrainfo |