Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2003

    Unanswered: Insert values from another table

    Hi folks,

    Suppose I have this table


    name | family_name | address
    bob johnson 1212 albert st.
    lori gaudio 2424 city square

    Each of these fields are set to NOT NULL

    I have another table with the same strucutre but no values in it.

    I want to update the empty table with the values of the first table but only the name and family_name. I would like to set the adress to a default value like '1111 madison st' for all people.

    If I do that :

    insert into table2 (name, family_name) select name, family_name from table1

    I get an error because it has to insert something in the address field (not null).

    Any ideas?

    Thanks in advance,

  2. #2
    Join Date
    Oct 2004
    insert into table2 (name, family_name,address) select name, family_name, '1111 madison st' from table1

    You can sub '1111 madison st' with any defaul value you want to use in single quotes.

  3. #3
    Join Date
    Feb 2003
    It works perfectly, thank you very much! :-)

  4. #4
    Join Date
    Feb 2003
    It works perfectly, thank you so much! :-)

    Best regards,

Posting Permissions

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