Link to home
Start Free TrialLog in
Avatar of 2326ac
2326ac

asked on

How to use SQL formula in table design?

I have two fields in my table - firstname and surname - I would like to have a field named whole name and the value of the previous fields I mentioned put into this as a default value.

How can I go about doing this?
Avatar of Aneesh
Aneesh
Flag of Canada image

CREATE TABLE [tablename] (
    [fname] [varchar] (50)  ,
    [lname] [varchar] (50)  ,
    [name] AS (isnull(([fname] + ' '),'') + isnull([lname],''))
) ON [PRIMARY]
GO


Avatar of 2326ac
2326ac

ASKER

I am new to SQL to server can this be done within the table design using the formula field, sorry im used to MS Access
ASKER CERTIFIED SOLUTION
Avatar of imran_fast
imran_fast

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think You should have split the points
:(
Avatar of 2326ac

ASKER

Sorry aneeshattingal quite new to this and did not think about that.  I will think more carefully next time