SQL SELECT multiple columns into one

I have this query in SQL Server 2008:

SELECT Id, Year, Manufacturer, Model FROM Table 

and i need something like this ...

 SELECT Id, (Year + [space] + Manufacturer + [space] + Model) AS MyColumn FROM Table 

How can I get this result?

+7
source share
2 answers

I think that all integer or numeric data types that you need are converted to String data type. When you can create your new column.

Query:

 SELECT Id, (Cast([Year] as varchar(4)) + ' ' + Manufacturer + ' ' + Model) AS MyColumn FROM Tablename 
+8
source

just use ' '

 SELECT Id, ([Year] + ' ' + Manufacturer + ' ' + Model) AS MyColumn FROM Tablename 
+6
source

All Articles