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
 Concatenate Columns in Query

Author  Topic 

SQLFOX
Starting Member

45 Posts

Posted - 2011-01-12 : 10:41:18
Is there a way that I can return all columns in the 'Employees' table and contatenate the Firstname and Lastname columns without having to list all individual columns? Is the query below the only way to do it?

Select Firstname +' '+ Lastname, Department, Salary, StartDate From Employees

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-12 : 10:44:14
its the only way. else you can use this

Select Firstname +' '+ Lastname, * From Employees


but this will still include Firstname , Lastname columns also after concatenated result

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

Go to Top of Page

SQLFOX
Starting Member

45 Posts

Posted - 2011-01-12 : 10:56:20
Thanks for your help :-)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-12 : 11:04:18
welcome

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

Go to Top of Page
   

- Advertisement -