T-SQL Column alias on computed column - Invalid column name

Viewed 28888

I'm using an alias to refer to a computed column. Here is a snippet from the actual code I'm trying to make work, to compute similarity and return matches where the similarity score is 3 or higher.

select [FirstName], difference([FirstName], 'mitch') as similarity
from [Dev].[dbo].[Name]
where similarity > 2
order by similarity desc

Exception Message:

Invalid column name 'similarity'.

As similarity is not a real column, how would I make this work?

4 Answers
Related