Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


How do I populate a specific column based on other columns in the same table?

Posted on 2009-05-01
Medium Priority
Last Modified: 2012-05-06
I am trying to populate a column with concated values from other columns in the same table.  This 'new column' is blank and needs to be filled like so:

1  |   2  |  3  |  4  | new colum
a  |  b  |  c  |  d  |       abcd
e  |  f  |  g  |  h  |        efgh

and so on.  Can I construct a query that will fill every row of 'new column' with the values from the other 4 columns?
Question by:edgecrusher762
LVL 93

Accepted Solution

Patrick Matthews earned 500 total points
ID: 24281978
UPDATE SomeTable
SET NewColumn = COALESCE([1], '') + COALESCE([2], '') + COALESCE([3], '') + COALESCE([4], '')

Author Closing Comment

ID: 31577000
Thanks a ton.  Works perfectly.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

564 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