DF_DRIVER_TRIM_VARCHAR_VALUES
Determines whether values are trimmed when stored in a SQL varchar column.
Level
Driver
Supported by
The DataFlex SQL Drivers (SQL Server, DB2, and ODBC), revision 6 and higher.
Type
String, temporary
Access
Read, Write
Values
True or False
Syntax
Use cli.pkg
Get_Attribute DF_DRIVER_TRIM_VARCHAR_VALUES of {driverNumber} to {BooleanVariable}
Set_Attribute DF_DRIVER_TRIM_VARCHAR_VALUES of {driverNumber} to {True|False}
Driver Configuration Keyword
Remarks
Determines whether values are trimmed when stored in a SQL varchar column. By default, this is set to False.
SQL database servers usually have char and varchar column types for storing string data. Char and varchar types behave differently when it comes to padding and trimming spaces and in string comparisons. Behavior may vary between char and varchar, as well as between different SQL database systems.
Chartypes are stored space-padded in the database. For example, in achar(10)column, when writing ‘Stephen’, it will be stored as ‘Stephen ’ (3 padding spaces).Varchartypes are not space-padded in the database. In avarchar(10)column, when writing ‘Stephen’, it will be stored as ‘Stephen’ (7 chars). When writing ‘Stephen ’ (2 padding spaces), it will be stored as ‘Stephen ’ (2 padding spaces).
See Padding and Trimming in SQL Databases for more information.
The following sample code returns the setting of this attribute for the "MSSQLDRV" driver on all connected servers, if it is loaded in the current program.
Function DriverIndex String sDriver Returns Integer
String sCurrentDriver
Integer iDriver iNumDrivers
Get_Attribute DF_NUMBER_DRIVERS to iNumDrivers
For iDriver from 1 to iNumDrivers
Get_Attribute DF_DRIVER_NAME of iDriver to sCurrentDriver
If (Uppercase(sDriver) = Uppercase(sCurrentDriver)) ;
Function_Return iDriver
Loop
Function_Return 0
End_Function
Procedure ShowDriverVarCharValueTrim
Integer iDriver
Boolean bTrim
Get DriverIndex "MSSQLDRV" to iDriver
If (iDriver <> 0) Begin
Get_Attribute DF_DRIVER_TRIM_VARCHAR_VALUES of iDriver to bTrim
End
End_Procedure