title: Conversion Failed when converting the varchar value 'Wired' to data type int
body: <p>So I have the following logic:</p>
  
  <pre><code>set nocount on
  
  select t1.*, ISNULL(t2.CountNewGLLinkIDs,0) AS CountNewGLLinkIDs
  
  from
  
  (select [Client_Number],[ClientName],[RemitType],[ClientServiceRep],[Backup_ClientServiceRep],       [ClientAuditor],[WirelessAuditor]
  ,[AccountManager],[ProvisioningRep],[BillingMonth], CASE RO.Inventory_Type WHEN 'WIRELESS' THEN 1     ELSE 0 END AS InventoryType, [NbrGLLinkIDs],[NbrInvoices],[AutoProcessCount] as [AutoProcessed]
  ,CONVERT(numeric(18,4), CONVERT(decimal, [AutoProcessCount])/CASE WHEN ISNULL([NbrInvoices], 1) =     0 THEN 1 ELSE ISNULL([NbrInvoices], 1) END) as AutoProcessPercentage
  ,[Spend],[EDI]
  ,CONVERT(numeric(18,4), CONVERT(decimal, [EDI])/CASE WHEN ISNULL([NbrInvoices], 1) = 0 THEN 1     ELSE ISNULL([NbrInvoices], 1) END) as EDIPercentage
  ,[Paper]
  ,CONVERT(numeric(18,4), CONVERT(decimal, [PAPER])/CASE WHEN ISNULL([NbrInvoices], 1) = 0 THEN 1     ELSE ISNULL([NbrInvoices], 1) END) as PaperPercentage
  ,[Import]
  ,CONVERT(numeric(18,4) , CONVERT(decimal, [Import])/CASE WHEN ISNULL([NbrInvoices], 1) = 0 THEN 1     ELSE ISNULL([NbrInvoices], 1) END) as ImportPercentage
  ,[TotalLateFees]
  ,[TotalLateFees]/CASE WHEN ISNULL([Spend], 1) = 0 THEN 1 ELSE ISNULL([Spend], 1) END as     LateFeesPercentOfSpend
  ,[NumberOfLateFees],[BalanceCarriedForward]
  ,[BalanceCarriedForward]/CASE WHEN ISNULL([Spend], 1) = 0 THEN 1 ELSE ISNULL([Spend], 1) END as     BCFPercentOfSpend
  ,[NumberOfBCFs],[ApprovedWithin5DaysOfDue],[ApprovedAfterDue],[ProcessedWithin5DaysOfDue],    [ProcessedAfterDue],[AvgDaysToProcess]
  ,[NewMasterAccounts]
  ,[BANCount] AS [NewAccountBANCount]
   FROM [RollupReports].[dbo].[report_Rollup_KPI_Approval] RO with (nolock)) t1
  
  
  left outer join
  
  --get count of gllinkid during months required
  (select client_number, CASE WHEN InventoryType = 1 THEN 'WIRELESS' ELSE 'WIRED' END AS     InventoryType,
  cast(datepart(mm,DateCreated) as varchar(2)) + '/01/' + cast(datepart(yyyy,DateCreated) as     varchar(4)) as BillingMonth,
  count(gllinkid) as CountNewGLLinkIDs 
  from glacct with (nolock)
  inner join 
      (select vendor,MAX(InventoryType) as InventoryType
      FROM tbl_Ref_Vendors with(nolock)
      group by vendor) as VendorData ON glacct.vendor = VendorData.Vendor
  where Client_Number in
      (select distinct client_number
       FROM [RollupReports].[dbo].[report_Rollup_KPI_Approval]  with (nolock))
  group by client_number, cast(datepart(mm,DateCreated) as varchar(2)) + '/01/' +     cast(datepart(yyyy,DateCreated) as varchar(4)),
  InventoryType) t2
  
  ON t1.Client_Number = t2.client_number and t1.BillingMonth = t2.BillingMonth and t1.InventoryType     = t2.InventoryType
  order by t1.ClientName, t1.InventoryType, t1.BillingMonth DESC
  </code></pre>
  
  <p>Which gives me this error here: Conversion failed when converting the varchar value 'WIRED' to data type int. </p>
  
  <p>I've searched everywhere and tried casting it to varchar but I feel like my lack of experience its not helping. If anybody can just point out why I'm getting this error so I can learn on how to fix this that would be great! </p>
  
  <p>ps: Sorry for my English.</p>