Is it OK to have a NULL value for the datetime datatype in the database?

advertisements

I have this table Equipment Activity Table

CREATE TABLE EqpActivityTBL
(
    EqpAct_ID              INT PRIMARY KEY IDENTITY(1, 1),
    EqpAct_BorrowDateTime  DATETIME,
    EqpAct_ReturnDateTime  DATETIME,
    EqpAct_Room            VARCHAR(50),
    SysUser_ID             INT FOREIGN KEY REFERENCES SysUserTBL,
    DeptMember_ID          INT FOREIGN KEY REFERENCES DeptMemberTBL,
    Eqp_ID                 INT FOREIGN KEY REFERENCES EqpTBL,
    EqpAct_Status          VARCHAR(50)
)

As you can see, I have an EqpAct_ReturnDate column. It will have a value of the date once an equipment is returned. But if it wasn't returned or maybe destroyed or perhaps something bad happened to it(sending it to dark hole perhaps) , can I insert a NULL value in that column? It has a datetime data type, anyways. I'm trying to show here that something has failed to return. I'm trying my best to avoid NULL value on the other data types.

Bottomline is: Is it fine to have a NULL value on datetime?

Thanks in advance


Yes, that works fine. A null value represents a missing value better than using some magic date value.

There may be a slightly lower perfomance using a field that can handle null, so you should disallow it for the fields that shouldn't ever be null.