Hi
I am being slow this afternoon (for a change).
I am looking at editing the SQL query below and i was going to re-write this but instead i thought I would try to fix this to help me understand what the issue is.
Basically it is failing due to the '-' in the data but i cant get my head around a solution.
Anyone got any ideas?
Cheers
select tt.*,
ORDR.DocNum, ORDR.CardCode AS 'BP Code', ORDR.docduedate as 'Due Date', rdr1.ItemCode, rdr1.Dscription,
rdr1.OpenCreQty as 'Open Quantity', RDR1.Price as price, rdr1.OpenQty, rdr1.OpenSum, rdr1.Project,ORDR.CardName AS 'BP Name',ordr.U_SHIP_NAME, ordr.U_SHIP_ADD1, ordr.U_SHIP_ADD2, ordr.U_SHIP_CITY, ordr.U_SHIP_PROV, ordr.U_SHIP_ZIP, ordr.U_SHIP_CNTRY
from ordr inner join rdr1 on ordr.docentry=rdr1.docentry and rdr1.linestatus='O'
inner join
(select CUST_NUM, SHIP_NAME, HOST_ORDER AS 'Document Number', PACKSLIP AS 'Warehouse Number', CUST_PO AS 'Customer PO',
case
WHEN PROCSTEP = '1' then 'UNALLOCATED'
WHEN PROCSTEP = '2' then 'WAIT PRE RATE'
WHEN PROCSTEP = '3' then 'HELD SHORT'
WHEN PROCSTEP = '4' then 'HELD REPENISH'
WHEN PROCSTEP = '5' then 'READY TO WAVE'
WHEN PROCSTEP = '6' then 'WAVED'
WHEN PROCSTEP = '7' then 'TO BE SCANNED'
WHEN PROCSTEP = '8' then 'TO BE PICKED'
WHEN PROCSTEP = '9' then 'TO BE REPACKED'
WHEN PROCSTEP = '14' then 'SUSPENDED'
WHEN PROCSTEP = '17' then 'RATING'
ELSE ''
END PROCSTEP
from rbeacon.dbo.PICKHEAD
where procstep = '3'
or procstep = '4'
or procstep = '1'
or procstep = '2'
or procstep = '5'
or procstep = '6'
or procstep = '7'
or procstep = '8'
or procstep = '9'
or procstep = '14'
or procstep = '17'
) tt
on tt.[Document Number]=ordr.docnum
I am being slow this afternoon (for a change).
I am looking at editing the SQL query below and i was going to re-write this but instead i thought I would try to fix this to help me understand what the issue is.
Basically it is failing due to the '-' in the data but i cant get my head around a solution.
Anyone got any ideas?
Cheers
select tt.*,
ORDR.DocNum, ORDR.CardCode AS 'BP Code', ORDR.docduedate as 'Due Date', rdr1.ItemCode, rdr1.Dscription,
rdr1.OpenCreQty as 'Open Quantity', RDR1.Price as price, rdr1.OpenQty, rdr1.OpenSum, rdr1.Project,ORDR.CardName AS 'BP Name',ordr.U_SHIP_NAME, ordr.U_SHIP_ADD1, ordr.U_SHIP_ADD2, ordr.U_SHIP_CITY, ordr.U_SHIP_PROV, ordr.U_SHIP_ZIP, ordr.U_SHIP_CNTRY
from ordr inner join rdr1 on ordr.docentry=rdr1.docentry and rdr1.linestatus='O'
inner join
(select CUST_NUM, SHIP_NAME, HOST_ORDER AS 'Document Number', PACKSLIP AS 'Warehouse Number', CUST_PO AS 'Customer PO',
case
WHEN PROCSTEP = '1' then 'UNALLOCATED'
WHEN PROCSTEP = '2' then 'WAIT PRE RATE'
WHEN PROCSTEP = '3' then 'HELD SHORT'
WHEN PROCSTEP = '4' then 'HELD REPENISH'
WHEN PROCSTEP = '5' then 'READY TO WAVE'
WHEN PROCSTEP = '6' then 'WAVED'
WHEN PROCSTEP = '7' then 'TO BE SCANNED'
WHEN PROCSTEP = '8' then 'TO BE PICKED'
WHEN PROCSTEP = '9' then 'TO BE REPACKED'
WHEN PROCSTEP = '14' then 'SUSPENDED'
WHEN PROCSTEP = '17' then 'RATING'
ELSE ''
END PROCSTEP
from rbeacon.dbo.PICKHEAD
where procstep = '3'
or procstep = '4'
or procstep = '1'
or procstep = '2'
or procstep = '5'
or procstep = '6'
or procstep = '7'
or procstep = '8'
or procstep = '9'
or procstep = '14'
or procstep = '17'
) tt
on tt.[Document Number]=ordr.docnum