January 2, 2020 at 6:43 pm
, a.sku + p1.SHORT_DESC + ' ' + p1.LONG_DESC1 AS short_description
sku is numeric
the descriptions are nvarchar
It works until I add the sku to the front then I get Error converting data type varchar to numeric.
Any help is appreciated.
January 2, 2020 at 6:49 pm
Explicitly convert the SKU to something like a VARCHAR(10) using CAST or CONVERT.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 2, 2020 at 7:05 pm
Use CONCAT instead of the plus sign - CONCAT will take care of converting to the appropriate data type for you.
, CONCAT(a.sku, p1.SHORT_DESC, ' ', p1.LONG_DESC1) AS short_description
Declare @sku int = 1234
, @short_desc varchar(20) = 'short'
, @long_desc1 varchar(100) = 'this is the long one';
Select concat(@sku, '-', @short_desc, '-', @long_desc1);
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply