Question

I am using the LIST function to create a ';' delimited list of values. The type is numeric (19,2). For some reason the precision appears to be ignored when using the list function. When performing a simple select on this column the values look good, ie "12.00". However, if I use a LIST() my results are of format "12.000000"

This is my LIST usage:

LIST(case when tblWOService.PricePerVehicle is null then ' ' else CONVERT(decimal(19,2),tblWOService.PricePerVehicle end,';')

The CONVERT does not change the result. Any ideas?

Thanks!

Was it helpful?

Solution

Have you tried explicitly converting your empty string?

LIST(
    case when tblWOService.PricePerVehicle is null then CONVERT(decimal(19,2),' ')
        else CONVERT(decimal(19,2),tblWOService.PricePerVehicle) end,';'
)

I've run into a similar datatype issue with CASE statements in T-SQL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top