Have you ever wondered how Microsoft comes up with Default Constraint names?
The name consists of several parts separated by _
- DF : Default Constraint
- sysmail_p: First 9 characters of the table name
- last_ : First 5 characters of the column name
- Binary value of the columns’ default_object_id
| sysmail_profile | last_mod_datetime | 622625261
DF_ | _sysmail_p_ | _last__ | _251C81ED
12_ | _123456789_ | _12345_ | _…..
The T-SQL formula to work out the binary value is
SELECT
[name] AS column_name
, CAST(default_object_id AS varbinary(MAX)) AS binary_value
FROM sys.columns
WHERE 1=1
AND OBJECT_ID = OBJECT_ID('sysmail_profile')
AND default_object_id <> 0;

