[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to use SQL formula in table design?

Posted on 2006-11-15
6
Medium Priority
?
332 Views
Last Modified: 2012-05-05
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?
0
Comment
Question by:2326ac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17948612
CREATE TABLE [tablename] (
    [fname] [varchar] (50)  ,
    [lname] [varchar] (50)  ,
    [name] AS (isnull(([fname] + ' '),'') + isnull([lname],''))
) ON [PRIMARY]
GO


0
 

Author Comment

by:2326ac
ID: 17950132
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
 
LVL 28

Accepted Solution

by:
imran_fast earned 2000 total points
ID: 17971144
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17974417
I think You should have split the points
:(
0
 

Author Comment

by:2326ac
ID: 17978973
Sorry aneeshattingal quite new to this and did not think about that.  I will think more carefully next time
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17984794
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question