Conversion failed when converting the varchar value ' ' to data type int.

  • Here is my block of query :

    select o.ordernumber,o.ordertype,o.orderdate,od.number8xx,od.resporgid,o.servicelocationid,od.channelgroup,od.channelswitch,

    (select case isnull(a.ordernumber,100) when 100 then 'N' else 'Y' end) as "2955",a.featurevalue as " 2955 Feature value",

    (select case isnull(b.ordernumber,100) when 100 then 'N' else 'Y' end) as "2956",b.featurevalue as "2956 Feature value"

    from orders o

    inner join orderfeatures ofe (nolock) on o.ordernumber =ofe.ordernumber

    inner join order8d od (nolock) on o.ordernumber =od.ordernumber

    left outer join

    (select s.Ordernumber,sf.featurevalue from

    orders s,orderfeatures sf where s.customerid = '05012078' and sf.productofferingid= 2955 and

    sf.ordernumber =s.ordernumber) a on a.ordernumber = o.ordernumber

    left outer join

    (select s.Ordernumber,sf.featurevalue from

    orders s,orderfeatures sf where s.customerid = '05012078' and sf.productofferingid= 2956 and

    sf.ordernumber =s.ordernumber) b on a.ordernumber = o.ordernumber

    where o.customerid = '05012078' and o.ordernumber in

    (select a.ordernumber from orders a,service8d b where

    a.instanceid = b.serviceid and

    a.instanceid in( select max(serviceid) from service8d where number8xx = b.number8xx)

    and b.number8xx in (

    '8002141290',

    '8002311448'))

  • With no sample data and no ddl, it's hard to help you here other then to give you some troubleshooting steps.

    Try commenting out portions of the code until you don't get the error. Then introduce one piece at a time back in until you do. Once you've located the specific line(s) of code causing it, you can look at the code and the data in the field to try to identify the cause.

    There's most likely an implicit conversion somewhere that's failing and you have an actual 0 length string in a field somewhere (instead of a null) that won't convert.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

Viewing 2 posts - 1 through 2 (of 2 total)

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