Stored Procedure Count <p>I am trying to get a dynamic count to print out but it is telling me @totalCAUUpdates needs a scalar value. Any thoughts?</p> <pre><code>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) &gt; 0 OR len(accountAccessoryUpdated) &gt; 0;'; raiserror (@updateSQL, 0,1) with nowait; EXEC (@updateSQL); </code></pre>