I recently accidently wrote a really ugly stored proc where I wished I had enums,
Eg.
CREATE PROCEDURE Proc_search_with_enum @user int, @account_category {enum}
I understand that SQL 2000 doesn't have enums as a first class language construct, which coding conventions do you use to simulate enums or otherwise address the same issue?
Or am I'm I doomed to just using VARCHAR and IF @account_category='cat1'?
EDIT: T-SQL and C# are the client languages.
EDIT: Thanks all! Lots of good advice, I wish I could accept several answers, I've voted everyone up-
Summary of answers
- Lean on C#'s enum by using int. Good for C# client code, makes TSQL client code less readable.
- Use Char/Varchar. Bad for C# client code (not good for localization), makes TSQL code more readable.
- Use parameter checking code to restrict the parameter, or use a constraint on a table column or a foreign key if the parameter is going to be inserted into a table.