0
votes

I am trying to concat the following columns

c.coursec + ' ' +  ms.sectionn, 

ms.secitonn is a (decimal 3,0)

Thus I am getting an error:

Arithmetic overflow error converting varchar to data type numeric.

c.coursec = 187C
ms.sectionn = 2
needed results is 187c-2 

I assume I must do some kind of cast or convert?

1
Were you able to find a solution here? Please consider marking answers or leaving comments if there was a different solution you've found. - crthompson

1 Answers

0
votes

You are correct, a convert will allow your string to concatenate.

c.coursec + ' ' +  Convert(varchar(50), ms.sectionn), 

Cast is valid as well:

c.coursec + ' ' +  CAST( ms.sectionn AS varchar(50)), 

Depending on the type of c.coursec you'll want to adjust your convert parameter. For example if c.coursec is nvarchar then modifying the cast would be appropriate.