string nextRepairDate = "''"; if (eqInfo?.NextRepairDate != null) { nextRepairDate = $"'{eqInfo?.NextRepairDate}'"; } insert into table(NextRepairDate) values(IF({nextRepairDate}= '',null,{nextRepairDate}))