I have two columns, one of data type Smallint and the other int. I am trying to concatenate the two columns and a ‘.’ to produce one final value but I keep getting the “Conversion failed when converting the varchar value ‘1.1’ to data type int error”. For instance, if I have ‘1’ in ColumnA and a ‘1’ in ColumnB, I want to concatenate them like CONCAT(ColumnA, ‘.’, ColumnB) to give me the value ‘1.1’. My code is below;
, CAST(CASE WHEN ColumnA IS NOT NULL AND (ColumnB = 0 OR ColumnB IS NULL) THEN ColumnA
WHEN ColumnA IS NOT NULL AND ColumnB IS NOT NULL AND ColumnB > 0 THEN CONCAT(ColumnA, '.', ColumnB) END AS NUMERIC(2,1)) AS 'VERSION'
I have tried all different Casts but nothing seems to be working. Any help would be much appreciated. Many thanks ina dvance.