How to run string math expression in SQL Server (trigger or function)
<p>I want to run:</p>

<pre><code> select Mycalculatefunction('((3*4)-3)*5') 
 select ('((3*4)-3)*5')
</code></pre>

<p>OUTPUT: <code>((3*4)-3)*5</code>  wrong (not int value)</p>

<p>My desired output is: 45</p>

<p>I defined a stored procedure:</p>

<pre><code>create PROCEDURE dbo.Eval
    (@exp varchar(MAX))
AS
    SET NOCOUNT ON

    DECLARE @SQLString NVARCHAR(MAX)
    SET @SQLString = 'SELECT '+@exp

    EXEC sp_executesql @SQLString
</code></pre>

<p>I call it: </p>

<pre><code>exec dbo.Eval '((3*4)-3)*5'
</code></pre>

<p>How can I do in this process is the trigger?</p>