Sql Server Computed Column Formula syntax Sql Server Computed Column Formula syntax sql-server sql-server

Sql Server Computed Column Formula syntax


A computed column must return a value, whereas you are just doing a comparison. Try this instead:

case when label is null then 0 else 1 end

SQL Server will not understand this as a non-NULLable column however. To handle that, change the computation to:

isnull(case when label IS NULL then 0 else 1 end, 0)