• This is a good basic question, thank you.

    I also paused for a minute before answering trying to figure out what could be a possible reason for this table not to be created? Default constraints can be null. The real question is why would anybody do it? What I mean is that if you remove the word default and the parenthesis around word null then you get pretty much same effect. For example,

    create table #TempTable

    (

    Tempnum int null,

    Tempname varchar (10) null

    );

    go -- table created;

    insert into #temptable default values; -- record inserted

    go

    The insert above clearly inserts a record with default values which happen to be null out of the box due to columns' definitions, so Tempnum int null is sufficient to instruct the engine that for any inserts null is used in absence of value. Maybe somebody knows a valid reason to create a table with column default (null). The only reason I can come up is that assumming white background and dark letters in the editor, typing extra words saves a little bit of electricity if left on the screen for long enough time, so Tempnum int default (null) is more environmentally friendly than simple Tempnum int null 🙂

    Oleg