I need to check the column and if the value entered is 1 digit, I need to make it two digits like 01. If the value is two digit already, just leave it alone.
I am using check constraint to accomplish this. But this is not working..Any help would be appreciated.
ALTER TABLE [dbo].TableName WITH CHECK
ADD CONSTRAINT [CheckColLength] CHECK (case when len(col) < 2 THEN '0' + col else col end=1))
Can we use Case statement in check constraint?
Thanks for your help.