Creating stored procedure with trigger (HOWTO ..)
I have 3 relational tables:
Boat - Boatname,sailNo(PK),
Cook - MemberNo(PK),name,SailNo(FK)
ClubCompetition - CompID(PK),endtime,SailNo(FK)
Boat may or may not have a cook and can enter 1 or more ClubCompetition
how do i create stored procedure with trigger so that i can update
only the tables with user supply input(let say table Boat and ClubCompetition only)
MemberNo is an autogenerateid so whenever i execute the procedure the cook table will be filled with
an ID and SailNo(foreignkey for table Boat)
CREATE PROCEDURE InsSamples
@BoatName varchar(150),
@MemberNo varchar(150),
@name varchar(150),
@endtime datetime
@Whatever
AS
Begin
Set NoCount on
Insert Boat(BoatName)
Values(@Boatname)
Insert into Cook
(MemberNo,name,SailNo)
Values
(@MemberNo,@name,scope_identity())
Insert into ClubCompetition
(CompID,endtime,SailNo)
Values
(@CompID,endtime,scope_identity())
|