Data Model > Frequently asked questions > What is the best way to create a new variable in a Data Model environment?
 
What is the best way to create a new variable in a Data Model environment?
I am working with metadata in an .mdd file and case data in a relational MR database. I opened the .mdd file, connected with the case data, and created a new variable using an SQL ALTER TABLE statement. Is this the best way to create a new variable?
The attempts to keep the metadata and case data synchronized when you use Data Definition Language (DDL) statements. However, DDL statements do not provide a very rich syntax for defining variables. Using DDL statements, you can define the variable name and data type, the size for text and categorical variables, and the category names for categorical variables. However, you cannot define label texts, custom properties, or minimum and maximum values using DDL statements.
The preferred mechanism for creating variables is therefore to use the MDM, which enables you to set all of the MDM properties. The case data can then be synchronized with the metadata by running an EXEC xp_syncdb statement.
However, the CDSCs vary in the features that they support. A CDSC may be write-enabled but not support the ability to alter the table or update rows that have already been written. For details of the supported features of the CDSCs that come with the Data Model, see Supported features of the CDSCs.
See also
Working with the Metadata Model
Creating and saving a variable
Frequently asked questions