You can add a new virtual column to the table that is the combination of the other 3 in this way:
alter table dbo.empleados
add NombreCompleto as nombre + ' ' + apPaterno + ' ' + apMaterno;
When you do select * from dbo.empleados
you will see that there is the new column:
Demo .
Reference: Specify columns calculated in a table .
It is also possible to add a new "normal" column to which you then assign the value of the combination of the other 3 columns. But if you do this, as you modify the values of the different columns, you would have to manually continue synchronizing the new column. That's why I suggest this form where the column is virtual and will always reflect the correct data according to the values of the other 3 columns.
Additional note: if it is possible that one of the 3 columns contains null
values, then using CONCAT
may be better than operator +
. You should try and see how you want to handle the null
values in those cases.