Home All Groups Group Topic Archive Search About

calculated columns in a table

Author
30 Jun 2006 9:19 AM
samuelberthelot
Hi,
I have a table with fields FirstName and LastName. I also have a column
FullName. Each time the table is updated, I'd like the field FullName
to be calculated automatically based on the values of FirstName and
LastName (FullName = FirstName + ' ' + LastName).
What Default value should I enter when I design the table ?

Thanks

Author
30 Jun 2006 9:31 AM
Omnibuzz
create table test1 ( firstnm varchar(10),
lastname varchar(10),
fullname as firstnm + ' ' + lastname
)


insert into test1 (firstnm,lastname) values ('Omni','buzz')

select * from test1

-Omni
Author
30 Jun 2006 9:49 AM
samuelberthelot
Thanks. that answers my question :)
Omnibuzz wrote:

Show quote
> create table test1 ( firstnm varchar(10),
> lastname varchar(10),
> fullname as firstnm + ' ' + lastname
> )
>
>
> insert into test1 (firstnm,lastname) values ('Omni','buzz')
>
> select * from test1
>
> -Omni

AddThis Social Bookmark Button