Jeff and .NET

The .NET musings of Jeff Putz

Sponsors

News

My Sites

How do you persist enumerations in SQL Server?

This is one of those developer pulse questions. How do you prefer to persist values from an enumeration in your database? I've seen people suggest using its corresponding numeric value as well as a string.

And for those of you really looking to the future, how do you do it for SQL Server 2005? If I understand it right, since you can use your own types in the database, it sounds like a good idea to do just that. What I'm not sure of is how you deploy the enumeration from your humble dozen lines of code to something that lives in the database.
Posted: Mar 01 2005, 03:03 PM by Jeff | with 2 comment(s)
Filed under:

Comments

Drew Marsh said:

We persist it numerically as the enum's base type (i.e. int for Int32, bigint for Int64, etc.).
# March 1, 2005 5:00 PM

Steve Hurcombe said:

Hi,
We actually persist textually as we find that it makes the system easier to report on, right readable queries for, and makes it easier for new developers to pick up.

Best regards
Steve
# March 1, 2005 5:37 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)