Results 1 to 3 of 3

Thread: Null vs Default

  1. #1
    Join Date
    Jun 2005
    Location
    Waukesha WI
    Posts
    78

    Unanswered: Null vs Default

    I have a table1 with a default value of 'ABCDEF' for my_id .
    I use a sql transform statement to place the data into that table from table2.
    Insert into table1
    (my_id)
    select
    (original_id)
    from table2

    In certain cases original_id appears to have a null value.
    I've noticed that the default value is NOT being utilized for my_id and my_id has a NULL.
    I realize I could use a NVL() to get the default value into the table, but shouldn't the default value be going into the table if the incoming field is null?

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    a DEFAULT vaue is ONLY used if the column that has the default is NOT included on the insert statement.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  3. #3
    Join Date
    Jun 2005
    Location
    Waukesha WI
    Posts
    78
    Thanks for the clarification Bill.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •