SQLTeam.com | Weblogs | Forums

How do one know data types of cells in columns in SQL

Hi,
I did a + operation but found that the data type in columns am trying to concatenate are not the same. Please how do one know data types of cells in columns in SQL

Use concat instead it handles it for you

@yosiasz - it actually depends on how the CONCAT is structured. There are cases where you do need to cast/convert the data.

With that said - I would recommend using CONCAT also, simply because you don't have to include NULL handling. And there is also CONCAT_WS which solves the problem of including delimiters when the column is a null (but not when empty).

1 Like