ansi_blanks option [compatibility]

Controls behavior when character data is truncated at the client side.

Allowed values

On, Off

Default

Off

Remarks

The ansi_blanks option has no effect unless the database ignores trailing blanks in string comparisons and pads strings that are fetched into character arrays. It forces a truncation error whenever a value of data type CHAR(N) is read into a C char[M] variable for values of N greater than or equal to M. With ansi_blanks set to Off, a truncation error occurs only when at least one non-blank character is truncated.

For embedded SQL with the ansi_blanks option set to On, when you supply a value of data type DT_STRING, you must set the sqllen field to the length of the buffer containing the value (at least the length of the value plus space for the terminating null character). With ansi_blanks set to Off, the length is determined solely by the position of the NULL character. The value of the ansi_blanks option is determined when the connection is established. Changing the option once the connection has been made does not affect this sqllen embedded SQL behavior.

When a database is blank padded, this option controls truncation warnings sent to the client if the expression being fetched is CHAR or NCHAR (not VARCHAR or NVARCHAR) and it is being fetched into a char or nchar (not VARCHAR or NVARCHAR) host variable. If these conditions hold and the host variable is too small to hold the fetched expression once it is blank padded to the expression's maximum length, a truncation warning is raised and the indicator contains the minimum number of bytes required to hold the fetched expression if it is blank padded to its maximum length. If the expression is CHAR(N) or NCHAR(N), the indicator may be set to a value other than N to take in account character set translation of the value returned and character length semantics.