Home Forums SQL Server 7,2000 T-SQL Conversion failed when converting the varchar value '98.97%' to data type int. RE: Conversion failed when converting the varchar value '98.97%' to data type int.

  • THANK YOU!!!!!!!!!!

    I ended up using 6,4 but here is the final query and thanks again!

    declare @compliantint

    declare @notcompliantint

    declare @totalint

    declare @percentdecimal(6,4)

    set @compliant = (select [# of patches] from vpatchcompliancecount where Status = 'compliant')

    set @notcompliant = (select [# of patches] from vpatchcompliancecount where Status = 'not compliant')

    set @total = (select SUM([# of Patches]) from vpatchcompliancecount)

    set @percent = (CONVERT(DECIMAL (6,4),100.0 *

    (select [# of Patches] from vpatchcompliancecount where Status = 'compliant')/(select SUM([# of Patches]) from vpatchcompliancecount)))

    select @compliant [Installed Patches], @notcompliant [Pending], @total [Total], @percent [Compliance %]