two colums become one | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

two colums become one

I have a table containing information about footballmatches. One column is homegoals and another is awaygoals. I want to put these two columns together as one ‘result’ column in a query (presented like this for: 1 – 0 ). How is this done? I tried this:
select homegoals + ‘-‘ + awaygoals as result
select homegoals & ‘-‘ & awaygoals as result Neither works. What is to be changed to make it work?
Could you post columns datatype? Luis Martin
Moderator Although nature commences with reason and ends in experience it is necessary for us to do the opposite, that is to commence with experience and from this to proceed to investigate the reason.
Leonardo Da Vinci Nunca esperes el reconocimiento de tus hijos, eso ocurrirá luego de tu muerte
All postings are provided “AS IS” with no warranties for accuracy.
If they are integer data types, then you need to use select cast(homegoals as varchar(10))+ ‘-‘ + cast(awaygoals as varchar(10)) as result from table Also you can do this in your Front End application if any
Madhivanan Failing to plan is Planning to fail