I have a table with 2 columns
CREATE TABLE mytable
(
x int
y char(1)
)
I would like to enforce constraint on y with respect to the value of x.
For example, when x = 5 I want to have y='a', when x = 12 y = 'b' and so on. Is it possible to do in SQL Server 2008? Something like
case when x = 5 then y='a' end
The latter statement does not work, therefore, I am asking for analog.