Error converting data type varchar to numeric.

  • hi am geting Error converting data type varchar to numeric.

    SELECT E.CRT_Cod,C.CP_Nm,R.Ret_MDN,E.Ret_Nm,E.Typ,c.mgr_cdmanm 'TSM',c.mgr_cdma 'TSM_No',c.lead_cdmanm 'Lead',E.DSR_NM,e.dsr_no,Business_category,

    ER_AVG 'LST_4_MTH_AVG_ER', b.amount_available 'BAL_EOD_YTD',Tran_Dt,

    sum(case when Day (Tran_Dt)= Day (GetDate()-1)and Tran_Typ = 'DT' Then MRP End) as 'MRP'

    INTO BNG_BAL_TDAY

    From Radar_Act R

    Left Outer JOIN ER_main E On R.Ret_MDN=E.ER_MDN

    Left Outer JOIN CP_MstrMn C on E.CRT_Cod=C.CRT_Cod

    Left Outer JOIN TSABBAL b on r.ret_mdn=b.donor_mdn

    Left Outer JOIN Day_Tran_CDMA D on r.ret_mdn=D.Recep_MDN

    Where CAT in ('CDMA') AND C.CP_TYP IN ('DIST','CDIST')AND c.clstr_nm like 'Beng%' AND

    BUSINESS_CATEGORY='CDMA' AND ER_AVG>=10 And E.Typ = 'Retailer'

    Group By E.CRT_Cod,C.CP_Nm,R.Ret_MDN,E.Ret_Nm,E.Typ,c.mgr_cdmanm,c.mgr_cdma,c.lead_cdmanm,E.DSR_NM,e.dsr_no,Business_category,ER_AVG,b.amount_available,Tran_Dt

    Thanks & Regards
    Sabari

  • There's to much going on to tell you where that problem lies.

    You are going to have to isolate it further.



    Clear Sky SQL
    My Blog[/url]

  • if you don't include a question in your post, how can you expect an answer?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Could be here:

    sum(case when Day (Tran_Dt)= Day (GetDate()-1)and Tran_Typ = 'DT' Then MRP End) as 'MRP'

    maybe you should add also ELSE phrase?

    And in where:

    Where CAT in ('CDMA')

    Why just not

    Where CAT = 'CDMA' ????

    Kindest Regards,

    Damian Widera
    SQL Server MVP,
    MCT, MCSE Data Platform, MCSD.NET

  • What's the data type of the following columns:MRP and ER_AVG?

    I assume, the columns used as join predicates all have corresponding data types, too...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply