Solved

How to use SQL formula in table design?

Posted on 2006-11-15
6
293 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

738 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