Viewing 5 posts - 1 through 5 (of 5 total)
pretend smaple data from the TMS table (sorry for the garbledness of it) - thank you very much for the answer - now it makes sense!
August 12, 2014 at 7:29 am
Contract_IDProductordercodeStartDateEndDateOfferIDRevision
111327140101/01/201331/07/2014101010102
215415200701/01/201306/12/2014202020205
215415400001/01/201306/12/2014202020205
215415410101/01/201306/12/2014202020205
215755990601/01/201306/12/2014202020205
21247353791001/01/201306/12/2014202020205
21247695220801/01/201306/12/2014202020205
21247792800301/01/201306/12/2014202020205
21247971760601/01/201306/12/2014202020205
21247972790101/01/201306/12/2014202020205
311826930501/01/201331/12/2014303030307
312183000301/01/201331/12/2014303030307
314574440201/01/201331/12/2014303030307
315680740001/01/201331/12/2014303030307
315704700301/01/201331/12/2014303030307
August 12, 2014 at 7:21 am
INSERT INTO DBO.Contract
(
ContractID,
3rdPartyFK,
CustomerFK,
OfferID,
Revision,
SoldDate,
StartDate,
EndDate,
SalesPerson,
SalesManager
)
SELECT
CASE
WHEN COUNT(DISTINCT(tms.Contract_ID)) = '1' THEN MAX(tms.Contract_ID)
ELSE '-1'
END AS Contract_ID,
MIN(pb.ParticipantPK) AS ParticipantPK,
CASE
WHEN COUNT(DISTINCT(tms.CustomerID)) = '1' THEN MAX(pc.ParticipantPK)
ELSE '-1'
END AS CustomerID,
tms.OfferID,
tms.Revision,
MAX(tms.DateSold) AS DateSold,
MAX(tms.StartDate) AS StartDate,
MAX(tms.EndDate) AS EndDate,
MAX(tms.Sold_By) AS Sold_By,
MAX(tms.salesmanager)...
August 12, 2014 at 7:12 am
written by someone else - I'm having to learn the ropes (the developer is no longer here)
August 12, 2014 at 6:58 am
Hi,
This is just a small excerpt from a much larger Stored Procedure and is linked to temp tables as well as system tables. I'm not sure how I can show...
August 12, 2014 at 6:56 am
Viewing 5 posts - 1 through 5 (of 5 total)