Reputation: 14780
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?
Upvotes: 9
Views: 52024
Reputation: 9724
I think all integer or numeric data types you need convert 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
Upvotes: 9
Reputation: 263723
just use ' '
SELECT Id, ([Year] + ' ' + Manufacturer + ' ' + Model) AS MyColumn
FROM Tablename
Upvotes: 8