August 27, 2010 at 4:57 am
Hi,
I have the following Coalesce Query
Coalesce (ProductClass,ProductColor,ProductID)
ProductClass and ProductColor are of the same datatype varchar , but the ProductID is of the Integer Data Type.
When I execute the query it gives the Data Conversion Error
i.e. Cannot Convert from int to character data type.
Can anyone help me in resolving the same.
And also :
Where exactly one can use the Coalesce Function.
Thanks
August 27, 2010 at 5:22 am
All data types in the coalesce function must be the same.
Try converting the ProductID into a varchar which has a length equal to the larger of productclass and productcolor.
e.g.
Coalesce (ProductClass,ProductColor,convert(varhchar(100), ProductID))
Kirman (8/27/2010)
Hi,I have the following Coalesce Query
Coalesce (ProductClass,ProductColor,ProductID)
ProductClass and ProductColor are of the same datatype varchar , but the ProductID is of the Integer Data Type.
When I execute the query it gives the Data Conversion Error
i.e. Cannot Convert from int to character data type.
Can anyone help me in resolving the same.
And also :
Where exactly one can use the Coalesce Function.
Thanks
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply