I have a bitwise enumeration with FlagsAttribute installed above it, like this -
[FlagsAttribute] public enum MyEnum { None = 0, First = 1, Second = 2, Third = 4, Five = 8, Six = 16, Seven = 32, Eight = 64, Nine = 128 }
Now, in C #, I save this value in the say property MyProperty, and when I save it, I write this property to my SQL database in the integer column. Suppose that if I selected First,Second,Five from the code, then in the database it will be saved as '11' .
I know that I can extract the value from the database and just need to specify the int value for MyEnum, and this will give me the values. But I want some manipulations to be performed on SQL data in some stored procedure, where, obviously, I cannot cast it to an Enum value. So, is there a way out that can tell me about the individual values.
As in the example, if 11 is stored, in any way that I can get as "1+2+8"
c # sql sql-server tsql wpf
Rohit vats
source share