Quantcast
Channel: SCN : Blog List - All Communities
Viewing all articles
Browse latest Browse all 2548

When you have a list of returns but not sure which ones have been returned

$
0
0

CMR SAP query.PNGBeing a part of a multinational company sometimes it is hard to keep track of returns. I had written a query that take a list of return numbers and generates results of items not in the system.

declare @myString varchar(100)='123,RTV0267111,RTV0269188,RTV0284929,RTV0284782'  
;WITH
cte AS
( SELECT CAST(N'' +Replace(@myString,',','') + '' as XML) AS vals )
SELECT s.a.value('.', 'NVARCHAR(50)') as num
FROM cte CROSS APPLY vals.nodes('/H/r') S(a) 
EXCEPT
select DISTINCT NumAtCard from ORIN
WHERE FatherCard = 'GTHead' AND DocType = 'I' AND CANCELED = 'N'  ORDER BY NUM;


Viewing all articles
Browse latest Browse all 2548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>