我会得到一个如下字符串,它将是一个数学表达式 1)5 + 5 * + Min(5,5,9) =? 2)Max(5 + 5,5 + 9,8-3)+ 6 =? 3)Max((5 + 5),(5) +9),(8-3))* 9 =? 4)(最大(最小(5,5),最大(5,9),最小(3,9))* 8 )+ 23 =? i将在sql server中获取它,因为string.I需要通过sql server获取字符串的输出 。这个字符串纯动态。 如果有任何解决方案,请帮助我。 谢谢 Ayan
Hi , I will get a string like below , it will be a mathematical expression 1)5+5*+Min(5,5,9)=? 2)Max(5+5,5+9,8-3)+6=? 3)Max((5+5),(5+9),(8-3))*9=? 4)(Max(Min(5,5),Max(5,9),Min(3,9))*8)+23=? i will get it in sql server , as string.I need to get the output of the string by sql server.This string purely dynamic. Please help me , if any solution is available. Thanks Ayan
推荐答案考虑到这一点,我认为这是一个糟糕的想法... In SQL你可以执行动态查询,所以你可以做这样的事情 With the consideration, that this looks me as an awful idea... In SQL you can execute dynamic queries, so you can do something like this DECLARE @SQL VARCHAR(MAX) = 'SELECT (5+5)' EXEC(@SQL)
您需要注意的一点是表达式的有效格式 - 在您的示例中并非所有表达式都是有效的SQL ...
One point you have to take care of is the valid format of the expressions - in your samples not all expressions are valid SQL...
更多推荐
SQL Server数学表达式
发布评论