f2s_mssql_auto_numeric_type_remapping_state¶
Applies to: MS SQL
Syntax
set_attribute f2s_auto_numeric_type_remapping_state of {DriverID} to {variable}
get_attribute f2s_auto_numeric_type_remapping_state of {DriverID} to {variable}
Parameter |
Description |
---|---|
DriverID |
The ID of the driver for which this applies. In most cases, you should use _f2s_ActiveDriverID. |
variable |
Boolean. True, remapping is on, false, remapping is off. Default is true. |
Description
Setting this attribute MUST be done within a structure_start/structure_end block.
Setting this attribute toggles off and on the automatic numeric data type remapping built into SQLFlex. When adding or creating smaller numeric columns during a restructure, SQLFlex will change the type to a more specific data type i.e. smallint or tinyint since they are handled more efficiently by the server. Setting this attribute to false will force SQl to keep the column as a numeric field, preserving the length and precision. Setting this attribute to true will leave the remapping up to the driver.
Getting this attribute can be done anywhere in code and returns whether remapping is on (true, the default) or off (false).
Examples
get_attribute
Boolean bIsOn
Get_Attribute f2s_mssql_auto_numeric_type_remapping_state of _f2s_ActiveDriverId to bIsOn
set_attribute
Handle hFile
Integer iColumn
Move newcust.File_Number to hFile
Structure_Start hFile _f2s_ActiveDriver
Move 0 to iColumn
Create_Field hFile At iColumn
//when looking at the raw data, this column will be a tinyint
//even though it is defined as numeric (DF_BCD)
Set_Attribute DF_FIELD_NAME of hFile iColumn to "ChangeCol"
Set_Attribute DF_FIELD_TYPE of hFile iColumn to DF_BCD
Set_Attribute DF_FIELD_LENGTH of hFile iColumn to 1
//when looking at the raw data, this column will be numeric(1,0) as defined
Set_Attribute f2s_mssql_auto_numeric_type_remapping_state of _f2s_ActiveDriverId to False
Move 0 to iColumn
Create_Field hFile at iColumn
Set_Attribute DF_FIELD_NAME of hFile iColumn to "NoChangeCol"
Set_Attribute DF_FIELD_TYPE of hFile iColumn to DF_BCD
Set_Attribute DF_FIELD_LENGTH of hFile iColumn to 1
Structure_End hFile DF_STRUCTEND_OPT_NONE "." 0
Replaces: Command SET_AUTOMATIC_NUMERIC_DATATYPE_REMAPPING