gvs
gvs

Reputation: 39

Invalid number: not a valid number string error while CAST

I am working on scripter calculation view and one of my requirement is to select Quantity field (decimal) from a table and concatenate with character string.

   select cast(a.kwmeng as varchar) + ' * Textabc' as "QuantityFormula" 

where Quantity formula is NVARCHAR type. When I activate the view i am receiving the following error.

Could not derive table type for variable "VAR_OUT" (SQL error: invalid number: not a valid number string

Can you guys provider pointers to fix this error.

Upvotes: 0

Views: 6955

Answers (1)

Konrad Z.
Konrad Z.

Reputation: 1652

I think that the problem is with the + symbol. Try to use || instead. For your example it will be:

select cast(a.kwmeng as varchar) || ' * Textabc' as "QuantityFormula" 

Upvotes: 1

Related Questions