How to convert a string to an integer

0

Hi, I am having an issue converting a string to an integer.  

 

 

select
 
    vendor.name as vendorname,
    part.num as partnum,
    part.description as partdesc,
    CAST(coalesce(crit.info,0) as Integer) as criticallevel,
    COALESCE(partreorder.reorderpoint,0) as ROP,
    COALESCE(partreorder.orderuptolevel,0) as OUL,
    cast(coalesce(qtyOnHand.qty,0) as Integer) - cast(coalesce(qtyAllocated.qty,0) as Integer) - cast(coalesce(qtynotavailable.qty, 0) as Integer) as "Qty Available",
    cast(coalesce(partreorder.orderupToLevel,0) as Integer) - cast(coalesce(qtyOnHand.qty,0) as Integer) - cast(coalesce(qtyallocated.qty,0) as Integer) - cast(coalesce(qtyNotAvailable.qty,0) as Integer) + cast(coalesce(qtyDropShip.qty,0) as Integer) + cast(coalesce(qtyOnOrder.qty,0) as Integer) as "To Order"
 
from part
 
      INNER JOIN vendorparts on vendorparts.partid = part.id
      INNER JOIN vendor on vendorparts.vendorid = vendor.id
      LEFT JOIN customset as ctpfg on ctpfg.recordid = part.id and ctpfg.customfieldid = 73
      LEFT JOIN customvarchar as crit on crit.recordid = part.id and crit.customfieldid = 38
      LEFT JOIN partreorder on partreorder.partid = part.id
      LEFT JOIN qtyonhand on qtyonhand.partid = part.id
      LEFT JOIN qtyallocated on qtyallocated.partid = part.id
    LEFT JOIN qtynotavailable on qtynotavailable.partid = part.id
    LEFT JOIN qtydropship on qtydropship.partid = part.id
    LEFT JOIN qtyonorder on qtyonorder.partid = part.id
 
where ctpfg.info = 'Book'
and coalesce(crit.info, 0) > coalesce(qtyOnOrder.qty,0) - coalesce(qtyAllocated.qty,0)
 
I have this code in the query section of IREPORT.  But in the condition section of the query it is telling me that (ERROR: SQL Problems:GDS Exception.  35544334. Conversion error from String "B".
 
I also tried cast(coalesce(qtyOnOrder.qty,0) as Integer) and it is still giving me an error.  I am not sure what to do in this case.  Someone's assistance would be greatly appreciated. Thank  you!
birju's picture
2
Joined: May 31 2013 - 7:08am
Last seen: 6 years 1 month ago

0 Answers:

No answers yet
Feedback
randomness