I have the below code and I am trying to insert a blank row when the date changes (column early_shpdte). I have tried multiple things such as char(13)+ char(10) but nothing works. I am just a beginner trying to master this skill. Can someone help me out?
Code:
SELECT CASE
when ship.shpsts = 'I' and DateDiff(Day, 0, shipment.early_shpdte) <= DateDiff(Day, 0, GetDate()) then 'Picked'
when ship.shpsts = 'I' and DateDiff(Day, 0, shipment.early_shpdte) = DateDiff(Day, 0, GetDate()) +1 then 'Picking'
when ship.shpsts = 'I' and DateDiff(Day, 0, shipment.early_shpdte) > DateDiff(Day, 0, GetDate()) +1 then 'Allocated'
when ship.shpsts = 'L' then 'Loading'
when ship.shpsts = 'S' then 'Staged'
when ship.shpsts = 'C' then 'Shipped' end shpsts, ship.ship_id, shipment.alcdte, convert(varchar,stgdte,101)as stgdte, shipment.early_shpdte,
line.inpqty, line.stgqty, ord_line.prtnum, ord_line.host_ordqty, ord_line.pckqty,
ord.cponum, adrmst.adrnam
FROM
{ oj (((XXx.dbo.shipment shipment INNER JOIN XXx.dbo.line ship_line ON
ship.ship_id = shipment_line.ship_id)
INNER JOIN dlx.dbo.ord_line ord_line ON
shipment_line.client_id = ord_line.client_id AND
shipment_line.ordnum = ord_line.ordnum AND
shipment_line.ordlin = ord_line.ordlin AND
shipment_line.ordsln = ord_line.ordsln)
INNER JOIN dlx.dbo.ord ord ON
ord_line.client_id = ord.client_id AND
ord_line.ordnum = ord.ordnum)
INNER JOIN dlx.dbo.adrmst adrmst ON
ord.st_adr_id = adrmst.adr_id}
WHERE
(ship.ship_id NOT LIKE 'RT%' AND
ship.ship_id NOT LIKE 'JUG%') AND
(shipment.stgqty = 0 AND
ord_line.pckqty = 0 OR shipment_line.inpqty = 0) AND
shipment.alcdte > {ts '2007-05-21 00:00:00.00'} AND
(ship.shpsts = 'S' OR
ship.shpsts = 'R' OR
ship.shpsts = 'I' OR
ship.shpsts = 'B')