Convert integer to a list of week days
I have an integer stored in a database (SQLAgent Frequency Interval) This integer is actually the sum of the selected days of the week that the schedule is to run The possible values are any combination of these values Sunday =1 Monday = 2 Tuesday =4 Wednesday= 8 Thursday = 16 Friday = 32 Saturday =64 ex 65 means that the schedule should run on Saturday and Sunday My problem is that I need to represent these values as the text "Saturday" and "Sunday" when given 65 and I am trying to do this in SQL Other than a huge CASE statement with all of the possible combinations can anyone think of a way