Your technology certification is waiting. Enroll in Cloud Class ®
CREATE TABLE vendor(id INT IDENTITY(1,1), vendor NVARCHAR(100), countAux INT DEFAULT (0));
CREATE TABLE vendorAUX(id INT, vendor NVARCHAR(100), aux NVARCHAR(100));
DECLARE @id INT;
INSERT INTO vendor(vendor) VALUES('V123')
SET @id = SCOPE_IDENTITY();
INSERT INTO vendorAUX(id, vendor, aux) VALUES(@id, 'V123', 'test')
INSERT INTO vendorAUX(id, vendor, aux) VALUES(@id, 'V123', 'test some more')
INSERT INTO vendorAUX(id, vendor, aux) VALUES(@id, 'V123', 'test again')
CREATE TRIGGER trg_vendor ON Vendor FOR UPDATE
SET a.vendor = i.vendor
FROM vendorAUX a
INNER JOIN inserted i ON i.id = a.id
CREATE TRIGGER trg_count_aux ON VendorAUX FOR UPDATE
SET v.countAux = (SELECT COUNT(*) FROM vendorAUX WHERE id = v.id)
FROM vendor v
INNER JOIN inserted i ON i.id = v.id
SET vendor = 'V234'
WHERE vendor = 'V123';
SELECT * FROM vendorAUX;
SELECT * FROM vendor;
Open in new window
Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.