I'm trying an 0, before every column in my sql
select TemporaryStock * '0,'+ cast( VAT as varchar(50)) from Market
i get error Msg 8114, Level 16, State 5, Line 1 Error converting data type varchar to float.
I'm trying an 0, before every column in my sql
select TemporaryStock * '0,'+ cast( VAT as varchar(50)) from Market
i get error Msg 8114, Level 16, State 5, Line 1 Error converting data type varchar to float.
You don't need to cast... you just need to move the decimal.
select TemporaryStock * (VAT * 0.01) from Market
If you want every value to be like 0.###### then you can use:
select TemporaryStock * convert(decimal(38,37),'0.' + convert(varchar,VAT))
If you want to add '0' before the VAT then use CONCAT(args1, args2) method:
select CONCAT('0',VAT) from ExpressMarket;
Note: Both the arguments should be of string type.
Or else you can refer the following to know more about how to concatenate and aliasing it.