What's the point of “NOT NULL DEFAULT '' ”?

后端 未结 7 846
时光说笑
时光说笑 2021-02-01 05:10

I\'ve seen this on a lot of fields on a DB from a project I\'ve been working on, where a column will be defined not null, but will have an empty string as the default. what\'s t

相关标签:
7条回答
  • 2021-02-01 06:10

    Most programming languages that interact with a database don't natively support a NULL that works the way it does in a database. For example in C#, null <> DbNull.Value. In VB most data types couldn't cope with null semantics, e.g. you couldn't store a null in a Date, or an Int, etc. By reducing the number of nulls the client programs see, the less headaches there are. In the case of VB, the closes thing that means null for strings is Empty, which is something closer to not-initialized, not quite the same meaning as NULL in the sense of a "not known"

    0 讨论(0)
提交回复
热议问题