declare @operator as varchar (10) = '>=' select Saldo from account where Saldo @operator 0
bq3bfh9z1#
您可以像这样使用sp_executesql:声明@运算符为NVARCHAR(10)= '〉='声明@SQLCmd AS NVARCHAR(64)= '从Saldo所在的帐户中选择Saldo ' + @运算符+ ' 0'执行sp_执行SQL @SQLCmd
1条答案
按热度按时间bq3bfh9z1#
您可以像这样使用sp_executesql:
声明@运算符为NVARCHAR(10)= '〉='
声明@SQLCmd AS NVARCHAR(64)= '从Saldo所在的帐户中选择Saldo ' + @运算符+ ' 0'
执行sp_执行SQL @SQLCmd