Link to home
Start Free TrialLog in
Avatar of Seven price
Seven priceFlag for United States of America

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

Open in new window

Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

What are you hoping to achieve with that?
ASKER CERTIFIED SOLUTION
Avatar of dannygonzalez09
dannygonzalez09

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of Seven price

ASKER

tks