Solved

How to use SQL formula in table design?

Posted on 2006-11-15
6
296 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 500 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

688 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