Hello I want create one insert trigger in that i have to table that
Table hardwaremaster
hardwareid hardwarename quantity
1 HDD 5 开发者_Python百科 and second table
2 RAM 2
Table transdetails
transid hardwareid
1 1
2 1
3 1
4 1
5 1
6 2
7 2
Here i want to create trigger in that once value come in hardwaremaster then it will update table transdetails . then how to write trigger in to it
This can help you :
CREATE TRIGGER TR_INS_WhatYouWant
ON hardwaremaster
AFTER INSERT
AS
DECLARE @hardwareid INT
SELECT @hardwareid = hardwareid FROM inserted
GO
INSERT INTO dbo.transdetails (hardwareid) VALUES (@hardwareid)
But I suggest to read this before make trigger work :
CREATE TRIGGER
精彩评论