Seven price
asked on
sql with qty slash price
Error converting data type varchar to numeric
,'BasePrice'=Case when BaseStorePrice = 1 then BaseStorePrice
else CAST((CAST(BaseStoreQty AS VARCHAR(100))) AS VARCHAR(100)) + convert( varchar(30), '/' ) + CAST(BaseStorePrice AS VARCHAR(100)) end
What are you hoping to achieve with that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Paraphrasing the above T-SQL...
CASE
WHEN BaseStorePrice = 1 THEN {a number }
ELSE {a varchar} END
CASE blocks with multiple WHEN..THEN..ELSE have to return a value of the same data type, so in this case returning either a numeric 1 or a varchar 'the quantity / the price' won't work.
Try '1' instead of 1 so that both will return a varcahr.
CASE
WHEN BaseStorePrice = 1 THEN {a number }
ELSE {a varchar} END
CASE blocks with multiple WHEN..THEN..ELSE have to return a value of the same data type, so in this case returning either a numeric 1 or a varchar 'the quantity / the price' won't work.
Try '1' instead of 1 so that both will return a varcahr.
ASKER
tks