Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 combining names

Author  Topic 

InNomina
Starting Member

40 Posts

Posted - 2012-02-22 : 17:28:05
I have 4 columns in 1 table
First
Middle
Last
Full

I would like to combine the first 3 in the fourth i.e.
Bush, George Walker

Would I Concatenate this?


-------------------------
"If you never fail, you're not trying hard enough"

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-22 : 17:37:36
[code]
UPDATE table
SET Full = First + COALESCE(' ' + Middle,'') + COALESCE(' ' + Last,'')
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-02-22 : 17:38:11
isnull(Last + ', ' , '') + isnull(First, '') + ' ' + isnull(Middle, '')


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

InNomina
Starting Member

40 Posts

Posted - 2012-02-22 : 18:59:34
Thank you both, I now have it working!!

-------------------------
"If you never fail, you're not trying hard enough"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-23 : 09:06:58
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -