DF_FIELD_IS_IDENTITY
Determines whether a column is an identity column.
Level
Column
Supported by
The DataFlex SQL Drivers (SQL Server, DB2, and ODBC), revision 6 and higher.
Type
Boolean, temporary
Access
Read / Write
Values
- True
- False
Syntax
Use cli.pkg
Get_Attribute DF_FIELD_IS_IDENTITY of {tableNumber} {columnNumber} to {BooleanVariable}
Set_Attribute DF_FIELD_IS_IDENTITY of {tableNumber} {columnNumber} to {True|False}
Remarks
MS SQL and DB2 allow you to define a single column as an identity column. An identity column is a numeric column (often int or bigint) whose value is automatically assigned when a new record is created. Using this instead of the System Table/DD auto-increment has the advantage that there is no locking contention on a system table. While identity columns may be assigned to any column, it is most often used with a numeric primary key (PK) column.
To create an identity column for a standard table within the Studio:
- Create a numeric column (int or bigint). This column will probably be your PK column as well.
- Set its DF_FIELD_IS_IDENTITY attribute to True.
- Make sure that your DD class does not mark this column as an auto-increment column. For example, if you converted a standard (non-Recnum) Customer table's Customer.Customer_Number to identity, you would also need to clear the DD's auto-increment setting.
After a new record is saved, the new identity value will be set in your table buffer.
Recnum tables always assign Recnum as the identity column, and this cannot be changed.