I don't know if this is possible but I figured I would give it a try....
I have a table with 6 columns:
The label column is a string, but the other columns datatype is the same as the column name (IntValue is an int, etc)
Now, each row will have a label, but only 1 value for the other 5. in other words, it will only have an intValue, or a DatetimeValue, etc... a row will not have 2 values and a label.
So here's my question. Can I use COALESCE and convert it to a string? I tried using this:
CAST(COALESCE(IntValue, DecimalValue, DateTimeValue, StringValue, MoneyValue) AS varchar(50)) AS CustomValue
It processes the first 3 or 4 rows then bombs with this error:
Conversion failed when converting date and/or time from character string.
is my format right? if so, is the COALESCE coming across bad data?
Thanks for your help as always!!!