Identity Columns (M to SQL Mapping)
[This content is no longer valid. For the latest information on "M", "Quadrant", SQL Server Modeling Services, and the Repository, see the Model Citizen blog.]
Microsoft code name “M” modeling language entities can have one or more identity fields specified that make up a unique key for the entity. This identity is the basis for entity relationships (one-to-one, one-to-many and many-to-many relationships).
“M”->SQL supports single- or multiple-field identities, and creates a primary key that contains those columns. “M”->SQL supports any type for identity (except unconstrained Text). It also supports the identity auto-numbering scheme of SQL.
“M”->SQL explicitly specifies the clustered keyword for the primary key even though it is the default for SQL. The clustered index is the index in which the data for the table is actually stored. This allows you to look it up very quickly when you use the primary key to look it up.
Unconstrained Text field identities are not supported because SQL cannot create a primary key for them. To use a Text field as an identity, constrain its length as shown in the following example.
Name : Text#50
Collection fields and fields that can be null are presently unsupported as part of a primary key.
Primary keys that take more than 900 bytes to store are presently unsupported due to limitations in SQL and print an error.
Examples
“M” Example | SQL Example | |
---|---|---|
Simple Identity |
|
|
Auto-numbering Identity |
|
|
Guid Identity |
|
|
Multiple Field Identity |
|
|