Python Forum

Full Version: In SQL Server, mix data types.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
While reading an article of SQL server on wiki thought that, In SQL Server, is it possible to merge data types? i.e., to have a cell's value be both a text and a number, with the text being a constant?

My table is named Contract. The value for the ContractID field should be "TCwxyz," where "TC" stands for text characters and "wxyz" for integers.

The following is what I have, however it doesn't appear to be working:

CREATE TYPE TenantContracts AS CHAR(6)
CHECK (SUBSTRING(VALUE,1,2)='TC'
AND (SUBSTRING(VALUE,2,4) AS SMALLINT)

Any help would be much appreciated. Thank you.