1
我试图获得一个动态计数来打印出来,但它告诉我 @totalCAUUpdates需要一个标量值。有什么想法吗?存储过程计数
declare @totalCAUUpdates as int = 0;
declare @realTableName as varchar(100) = '[_TEMP_SubscriptionTransactionsForMosoPay09022014]'
declare @updateSQL as varchar(1000) = 'select @totalCAUUpdates = count(*) from ' + @realTableName + ' where len(accountNumberUpdated) > 0 OR len(accountAccessoryUpdated) > 0;';
raiserror (@updateSQL, 0,1) with nowait;
EXEC (@updateSQL);
我如何使用sp_executesql的有效存储过程这与声明的变量使用它们? – user130045 2014-09-03 21:14:12