I have a table which has a column \'Faktor\' (varchar(50)) which contains expressions like:
1/3
2*9/5
0.567
0.23
No, I am searching a way t
too bad.
In the expression all numbers are int
datatype. So, its difficult to calculate and show the result in decimal
.
Here is a sample, hope it will help-
declare @expr nvarchar(10)
set @expr='2*9/5'
declare @query varchar(800)
BEGIN TRY
SELECT CAST(@expr as decimal(5,2))
END TRY
BEGIN CATCH
SET @query='SELECT CAST('+@expr+'.0 as decimal(5,2))'
EXECUTE(@query)
END CATCH