sql - Concat with NULL value -
I have a query that looks something like this:
separate call 1 Choose, select Ltim (str (col2)), 'from' @temp t2, where x2 path t2.col1 = t1.col1 (@ ')) @temp t1 to col2 < P> Some values in Col2 are zero, so instead of displaying a string with zero, that part is completely missing, i.e. should be col2
3 , 4,3, NULL, 2,3,4,3,2, but instead I'm getting:
3,4, 3,2,3,4,3, 2, How can I fix this Huh? To get tap output to
, you have to change the zero value in the string 'NULL'. It also means that you have to enter numeric values in a string for a corresponding type of field;
Select 1, (select COALESCE (CAST (col2 as VARCHAR), 'NULL'), 'FROM @temp T2 WHERE t2.col1 = t1.col1 XML path ('')) @temp t1 from col2.
Comments
Post a Comment