• lrosales (11/21/2008)


    Guys!

    I solved the problem. the answer is simply "Default"

    insert into tt99(Datetime2, description)

    values (default,'Testing the Default')

    simple is it not?

    😛

    If you want to use a default date in that column then yes, it works well but if you do not want to insert anything if there is no date then better insert a NULL into the column like this:

    insert into tt99(datetime2, description)

    values (NULL, 'Testing the Default')

    Let's say for instance you have a field DateofBirth and it is not compulsory to enter anything then you would not want to enter today's date but rather a NULL.

    Should this date be entered from a UI and the program returns an error when passing a NULL field then I would rather pass "" and in the SP put a case on the insert like this.

    case when DateofBirth = "" then NULL else DateofBirth end

    That's just my bit of advice.

    :-PManie Verster
    Developer
    Johannesburg
    South Africa

    I can do all things through Christ who strengthens me. - Holy Bible
    I am a man of fixed and unbending principles, the first of which is to be flexible at all times. - Everett Mckinley Dirkson (Well, I am trying. - Manie Verster)