I have a query in SQL Server 2008R2 that I want to run against a computed column that in turn I am going to index - in order to speed things up.
The column is of type int right now.
I cannot get the syntax right.
alter table dbo.tOutput Add StateNew as State IN (0, 10)
I get an error
Incorrect syntax near the keyword 'IN'.
The query, coming from C# entity framework, should then later on use the index and - well - be fast.
The C# seems to be converted to the IN usage, the original is like this:
tOutput.Where(x => (x.State == 0) || (x.State == 10))
The generated SQL reads
.. FROM tOutput WHERE State IN (0, 10) ..