I keep getting "error validating the formula" for a computed column I'd like to create. I have an INT column called YearMonth with values you'd expect (201511, 201512, 201601, etc.). I'd like a computed column to display the number of days in each YearMonth. The following works in a SELECT statement but not in a computed column:
DATEDIFF(day, (CAST((YearMonth*100)+1 AS CHAR(8))), (DATEADD(month, 1, CAST((YearMonth*100)+1 AS CHAR(8)))))
What rule am I unwittingly violating here?
"If I had been drinking out of that toilet, I might have been killed."