-- Evaluate dynamically expression in T-SQL DECLARE @tableFormula TABLE ( Formula VARCHAR(255), X INT, Y INT, Z INT ) INSERT INTO @tableFormula VALUES ('x+y*z', 1, 2, 3 ), ('(x+y)*z', 1, 2, 3 ) -- SELECT 7 -- SELECT 9 SELECT SQLNET::New(Formula) .ValueInt('x', X) .ValueInt('y', Y) .ValueInt('z', Z).EvalInt() as Result FROM @tableFormula
SQL Eval Function is a C# expression evaluator. You can evaluate arithmetic expressions, regex, and more directly in T-SQL.
Just click on Run button!
What ZZZ Projects achieved over the last decade has grown beyond our hopes. We help developers worldwide with free and paid solutions (because nobody works for free, nor our developers!). Every day, we are committed to listening to our clients to help ease the daily dev workload as much as possible.