• Disclaimer: What I am about to show is dangerous because you're trying to execute a statement passed in by a person or application, and people and applications should never be trusted to do the right thing when it comes to data, so if you use this technique make sure you are protecting against SQL injection.

    Here is one way you could handle it:

    DECLARE @v-2 VARCHAR(100); -- local variable for demo, but this could be an stored proc input param too

    SET @v-2 = '((7 + 1) / 3.0)'

    ----------------------

    -- the actual code

    -- setup a SELECT which will force the engine to eval your math problem

    SET @v-2 = 'SELECT ' + @v-2;

    -- setup a table variable to capture your result

    DECLARE @result TABLE (value VARCHAR(100));

    -- execute the SELECT to solve the math problem and cature the result in the table variable

    INSERT INTO @result (value)

    EXEC (@v);

    -- show the answer

    SELECT *

    FROM @result;

    One other note about your original post. SQL Server is forced to infer data types when you only supply a string for calculation meaning unless you provide numbers as decimals (see I changed your 3 to 3.0) then SQL Server will do the math based on integers and not decimals and you will not get the expected result.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato