title: How to set decimal precision dynamically using a variable
body: <p>I am trying to set decimal precision dynamically in a stored procedure like as below</p>
  <pre><code> DECLARE @precison int
   select @precison = [ConfigValue] from [TestData] WHERE ConfigName = 'Precision'
   select CAST( (10.56/10.25)as decimal(18, @precision))
  </code></pre>
  <p>If precision is '2' SP should return '1.03' as result.But cast function is not accepting @precision parameter as variable .I want to return data as decimal itself from stored procedure.How can i achieve this in SQL Server</p>