Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a table with three columns:

Name Surname NameSuname
Bob  Marley  NULL
John Doe     NULL

I want to insert values from Name and Surname columns into NameSuname column. How can I do that?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You need to update the coumn instead of inserting

UPDATE MyTable
  SET NameSuname = Name || ' ' || Surname 
share|improve this answer
    
Of course, you combine the 2 by using a trigger that fires after table insert, which will do the update for you, getting you back to the impression that you're only doing an insert. Plus it will be part of the same transaction, thus all fail or all succeed. –  StAlphonzo Jul 24 at 20:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.