BEGIN Метка A
CREATE PROCEDURE ShowMyRow
@inID nvarchar (8)
AS
SELECT ci.FirstName, ci.LastName, ci.EmailAddr, ci.Phone
FROM ContactInfo ci 
JOIN ExpiryDates ed
ON ci.MemberID = ed.MemberID
WHERE ci.MemberID = @inID AND ed.ExpiryDate >= GETDATE()
END Метка A
BEGIN Метка B
CREATE PROCEDURE EditMyRow
@inID nvarchar (8),
@inFN nvarchar (20),
@inLN nvarchar (30),
@inEA nvarchar (128),
@inPh nvarchar (12) = NULL
AS
UPDATE ContactInfo
SET FirstName = @inFN, LastName = @inLN, EmailAddr = @inEA, Phone = @inPh
FROM ContactInfo ci 
JOIN ExpiryDates xd
ON ci.MemberID = xd.MemberID
WHERE ci.MemberID = @inID AND xd.ExpiryDate >= GETDATE()
END Метка B

Поделитесь материалом с коллегами и друзьями