Where cannot we use "default"

  • Hi Everybody,

    One interviewer asked me this question.

    Where cannot we use "default"? What is that column?

    Any idea?

    Advance thanks.

  • a default sets the value of the column, so common sense would make you think of columns that cannot have the same value more than once.

    i'd test it to be sure, but off hand i'm thinking columns more than once would be:

    a column with identity,

    a primary key,

    one that has a unique constraint;

    columns that the default would conflict with an other constraint.

    can you think of any other situations?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Hi Lowell,

    Thank you very much for your answer. Nice reply.

  • it maybe useful to u -- http://www.blackwasp.co.uk/SQLDefaultColumns.aspx

    For better, quicker answers, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply