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 to execute a select like
select Faktor from Artikel
which should return a column of type decimal with the values
0.333333
3.6
0.567
0.23
I’d go with a CLR, something like this (this has the advantage of working in SET based operations whereas the dynamic sql alternatives (i.e. Abduls answer) will not):
EDIT: Source Code for the CLR dll (Visual Studio 2008) posted here: http://www.heavencore.co.uk/filehub/uploaded/EvalFunction.zip
If you would prefer to compile the assembly yourself, here is the code:
once installed and bound you could then do this:
Edit: OK, i have just tested this and it works fine in set-based operations etc, installation was as follows: