September 13, 2016 at 11:12 am
Hi Gang-
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?
Thanks!
September 13, 2016 at 11:28 am
As I recall that usually happens when using the SSMS GUI to create the column under some conditions (bugs, mostly, if memory serves).
Have you tried adding the column with TSQL?
Cheers!
September 13, 2016 at 11:37 am
You are correct, thank you! That was frustrating, really appreciate your help!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply