Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Should "lookup fields" be strings, ints, what?

Status
Not open for further replies.

gdrenfrew

Programmer
Aug 1, 2002
227
GB
In development, we have a couple of databases each similar, but each being designed by different developers.

Lookup Table on Dev
1 Approved
2 Rejected
3 Deleted
4 Cancelled

Lookup Table on Live
1 Approved
2 Rejected
3 Deleted
5 Cancelled


Without fail, someone will write a query based on the ID field of a look-up table. Then when that query is ported to live, doesn't look-up the same value and fails/returns wonky data.

So some developers build their queries by joining on the string value.

To me this seems pretty inefficient, or is it not a problem? I get unduly riled by this lack of a level playing field amongst us.

Is there a best-practice?
 
I normally use the ID(Int, Identity) column for look ups, however, there are times when I use the Desc. column. Just I would assume you want the Desc to be unique, so make sure you create a Unique Index on it.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top