I have done something like the following for an update. These examples re simplified.
But I'm confused as to how do this in an insert where I want to make sure the product is not discontinued just like the update. What am I missing here?
Auguy
Sylvania/Toledo Ohio
Code:
UPDATE R
SET R.status = '0'
FROM dbo.ProductReviews AS R
INNER JOIN dbo.products AS P
ON R.pid = P.id
WHERE R.id = '17190'
AND P.IsDiscontinued = 0;
Code:
Insert Into R
SET R.status = @Status, ReviewDate = @ReviewDate, etc.
FROM dbo.ProductReviews AS R
INNER JOIN dbo.products AS P
ON R.pid = P.id
WHERE R.id = '17190'
AND P.IsDiscontinued = 0;
Auguy
Sylvania/Toledo Ohio