I want to set the value of a column based on another column’s value by using Computed Column Specification in SQL Server.
Basically I want to set the columns’ value to be a link if it has a result associated (in another column). This is what I tried putting in the formula part of that column but I always get this
Error Validating formula
T-SQL code:
SELECT
CASE
WHEN D.TestResultId IS NOT NULL
THEN ('<a href="Analysis?Result=' + CONVERT(varchar(max), D.TestResultId) + '">Analysis</a>')
ELSE 'Pending Analysis'
END
FROM DailyReport AS D
The query by itself is working fine, but when put in that into the computed column specification it always returns that error. I even tried creating a stored procedure and calling it, but still the same issue. Can I get any help on this?
You don’t need the
SELECT - FROMpart on the computed column. It should just be: