Hello,
In SQL Server assuming one has columns that need to have the same data type is it possible to define a check constraint at the table (or database level) and apply that to a column when you define it?
As in this (contrived) example:
ALTER TABLE dbo.tblAuditTrail
ADD CONSTRAINT CK_DecimalNumber
CHECK (DecimalColumn LIKE '^\-?\d+\.\d+$')
GO
How now can you associate that with one or more columns having created it at the table level or is the answer to this to use a RULE viz.
CREATE RULE RU_Decimal
AS
@value LIKE '^\-?\d+\.\d+$'
GO
I know that the example is contrived and one would use a decimal column for decimal values but assume, because of a poor design choice, that this was an nchar column and you wanted to enforce some constraints on it.