Is there any way to combine data types in SQL Server? i.e. have the value of a cell to be both text and number where the text is always the same?
I have a table called Contract
. The ContractID
field should have the value of: 'TCwxyz' where 'TC' are string characters and 'wxyz' are integers.
I have the following but it doesn't seem to be working:
CREATE TYPE TenantContracts AS CHAR(6)
CHECK (SUBSTRING(VALUE,1,2)='TC'
AND (SUBSTRING(VALUE,2,4) AS SMALLINT)
Any assistance would be appreciated.