• If you want to evaluate more complex expression, the only easy way I know is with the SQL.NET product. It evaluates .NET expression directly in SQL stored procedure, function and trigger.

    -- CREATE expression

    DECLARE @sqlnet SQLNET = SQLNET::New('8*(1/2)-6')

    -- EVALUATE expression

    SELECT @sqlnet.Eval() -- (return: -6)quote]

    Here is the product link:

    https://github.com/zzzprojects/Eval-SQL.NET

    You can also use the .NET Runtime Compiler if you want to evaluate in your own CLR procedure:

    https://github.com/zzzprojects/Eval-Expression.NET

    Let me know if it worked for you.