Static DataLast updated: 2/24/2024

Quite often it’s the case where certain database tables contain data that rarely, if ever changes. A customer type table would be a good example. This type of data is a candidate for creating a static version.

SQL+ offers two different approaches to building static data. You can generate lists of data, or enumerations.

Static Lists

The table column structure of the query will be represented as properties in a class definition. Each row in the query creates an item in a list of static data, based on the same class definition.

Given the following data in the CustomerType table:

Generate static lists sample data

And the following query in the SQL+ Code Generation Utility:

Generate static lists configuration

The result would be the following. Comments have been removed for the purpose of this example.

Static list generation output

Enumerations

Enumerations work much the same way as static lists, however, the queries for enumerations must adhere to a particular format as follows:

  • Name: Alias the column that represents the string constant value as [Name].
  • Value: Alias the column that represents the numeric constant value as [Value].
  • Comment: Alias the column that represents a comment as [Comment] (optional).

Again with the following data in the CustomerType table:

Generate enumerations sample data

And the following query in the SQL+ Code Generation Utility:

Generate enumerations lists configuration

The result would be the following:

Enumeration generation output