General information
Forum:
Microsoft SQL Server
Environment versions
SQL Server:
SQL Server 2005
How do you store 0 vs. nothing in a numeric field?
Remember - I said generally speaking. The only time it matters if null is stored in a numeric field is in scenarios similar to storing test grades. If Johnny was absent on the day of the test, his score needs to be null because he presumably is going to make up the test and his score will probably be greater than zero. In this case, I would make the test score field nullable because missing the test is not the same thing as scoring zero on it and I need to make this distinction when averaging Johnny's test scores. In other scenarios, it really doesn't make a difference whether the field contains zero or null and, IMHO, storing zero makes writing the code a lot cleaner.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only