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?
2326acAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
imran_fastConnect With a Mentor Commented:
Yes it can be go to the table go to the design
add a new column name and put
isnull([fname] + ' ') + isnull([lname],'')
in the formula.
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
CREATE TABLE [tablename] (
    [fname] [varchar] (50)  ,
    [lname] [varchar] (50)  ,
    [name] AS (isnull(([fname] + ' '),'') + isnull([lname],''))
) ON [PRIMARY]
GO


0
 
2326acAuthor Commented:
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
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
Aneesh RetnakaranDatabase AdministratorCommented:
I think You should have split the points
:(
0
 
2326acAuthor Commented:
Sorry aneeshattingal quite new to this and did not think about that.  I will think more carefully next time
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.