In a database table we will have a column "Round" for which round of feeding
the record applies to at a cattle ranch. The value will always be either
1, 2, or 3 since we feed just that many times per day (kind of like
breakfast, lunch, and dinner).
In the table, would you make the column "Round" a TinyInt data type, or a
char(1)? I've heard that you shouldn't use Int unless there might ever be
some sort of math involved, but I'm not sure. I'm just loooking for the
"best practice" if there is one to apply to all such situations.
Thanks,
Ron Cook
Michael D. Ober - 30 Nov 2006 18:16 GMT
I would use int and then create an enum representing each valid value.
Reference the enum in your code.
Mike Ober.
> In a database table we will have a column "Round" for which round of
> feeding the record applies to at a cattle ranch. The value will always
[quoted text clipped - 8 lines]
> Thanks,
> Ron Cook
Rad [Visual C# MVP] - 30 Nov 2006 18:36 GMT
I'd use Int myself, then I can use that as an enum
>In a database table we will have a column "Round" for which round of feeding
>the record applies to at a cattle ranch. The value will always be either
[quoted text clipped - 8 lines]
>Thanks,
>Ron Cook
--
Bits.Bytes.
http://bytes.thinkersroom.com
Jon Skeet [C# MVP] - 30 Nov 2006 19:13 GMT
> I'd use Int myself, then I can use that as an enum
Why not use TinyInt and then use an enum which has byte as its
underlying type?

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Rad [Visual C# MVP] - 30 Nov 2006 20:03 GMT
TinyInt I meant. But then again int are just as workable I would think
>> I'd use Int myself, then I can use that as an enum
>
>Why not use TinyInt and then use an enum which has byte as its
>underlying type?
--
Bits.Bytes.
http://bytes.thinkersroom.com
Michael D. Ober - 30 Nov 2006 21:36 GMT
Can you give an example of using a byte as the underlying type of the enum?
I just need the syntax as I wasn't aware this could be done.
Thanks
Mike Ober.
>> I'd use Int myself, then I can use that as an enum
>
> Why not use TinyInt and then use an enum which has byte as its
> underlying type?
Jon Skeet [C# MVP] - 30 Nov 2006 21:51 GMT
> Can you give an example of using a byte as the underlying type of the enum?
> I just need the syntax as I wasn't aware this could be done.
public enum MyEnum : byte
{
FirstValue,
SecondValue
}

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Michael D. Ober - 30 Nov 2006 22:07 GMT
Thanks.
Mike.
>> Can you give an example of using a byte as the underlying type of the
>> enum?
[quoted text clipped - 5 lines]
> SecondValue
> }