SQL: avoiding hard-coding or magic numbers

后端 未结 11 1452
无人及你
无人及你 2020-12-14 17:18

Question: What are some other strategies on avoiding magic numbers or hard-coded values in your SQL scripts or stored procedures?

Consider a stored

11条回答
  •  难免孤独
    2020-12-14 17:51

    Don't rely on IDENTITY for all of your IDs. When you have a lookup table that's going to be less than 50 rows for example, it's perfectly reasonable to either define those lookups as having specific IDs or use a string valued code for them. In either case, "hard-coding" is no longer an issue.

提交回复
热议问题