Skeptical about Trigger!
-
Dude's, want to insert the values in one table(say bookingtable), the remaining seats column in another table must be suitably updated. Trying to concept using of Triggers. Can I go with the following way? but my table is not updated. Pls help on this. CREATE TRIGGER Trgupdtsts ON Table_FB2 FOR INSERT AS DECLARE @FNo INT, @DOJRNY DATETIME, @RMNGSTS INT SELECT @FNO = i.FNO, @DOJRNY = i.DOJRNY FROM inserted i; set @RMNGSTS = ("need to insert logic here?")--'Record Inserted' INSERT INTO TBL_FSTS (FNO , DOJRNY , RMNGSTS) VALUES (@FNO , @DOJRNY , @RMNGSTS) --select @RMNGSTS from inserted
-
Dude's, want to insert the values in one table(say bookingtable), the remaining seats column in another table must be suitably updated. Trying to concept using of Triggers. Can I go with the following way? but my table is not updated. Pls help on this. CREATE TRIGGER Trgupdtsts ON Table_FB2 FOR INSERT AS DECLARE @FNo INT, @DOJRNY DATETIME, @RMNGSTS INT SELECT @FNO = i.FNO, @DOJRNY = i.DOJRNY FROM inserted i; set @RMNGSTS = ("need to insert logic here?")--'Record Inserted' INSERT INTO TBL_FSTS (FNO , DOJRNY , RMNGSTS) VALUES (@FNO , @DOJRNY , @RMNGSTS) --select @RMNGSTS from inserted
-
Dude's, want to insert the values in one table(say bookingtable), the remaining seats column in another table must be suitably updated. Trying to concept using of Triggers. Can I go with the following way? but my table is not updated. Pls help on this. CREATE TRIGGER Trgupdtsts ON Table_FB2 FOR INSERT AS DECLARE @FNo INT, @DOJRNY DATETIME, @RMNGSTS INT SELECT @FNO = i.FNO, @DOJRNY = i.DOJRNY FROM inserted i; set @RMNGSTS = ("need to insert logic here?")--'Record Inserted' INSERT INTO TBL_FSTS (FNO , DOJRNY , RMNGSTS) VALUES (@FNO , @DOJRNY , @RMNGSTS) --select @RMNGSTS from inserted
Another one with a crappy design, available seats should be an enquiry on the Bookingtable! while using a trigger spit may fix this issue the design should be fixed to remove the need for a trigger spit
Never underestimate the power of human stupidity RAH
-
Another one with a crappy design, available seats should be an enquiry on the Bookingtable! while using a trigger spit may fix this issue the design should be fixed to remove the need for a trigger spit
Never underestimate the power of human stupidity RAH
One could get the opinion that you don't like triggers spit :laugh:
"The ones who care enough to do it right care too much to compromise." Matthew Faithfull
-
One could get the opinion that you don't like triggers spit :laugh:
"The ones who care enough to do it right care too much to compromise." Matthew Faithfull
One of my earliest sql jobs was to track down a bug, it was in a trigger spit and it took me ages to find the bloody thing, that was over 25 years ago and I have not forgiven them their sins!
Never underestimate the power of human stupidity RAH
-
One of my earliest sql jobs was to track down a bug, it was in a trigger spit and it took me ages to find the bloody thing, that was over 25 years ago and I have not forgiven them their sins!
Never underestimate the power of human stupidity RAH
I don't like them either, I'm considering triggers and
distinct
as a sign that there is something wrong in the design and query respectively. Cannot always be without them, but I try hard."The ones who care enough to do it right care too much to compromise." Matthew Faithfull
-
Another one with a crappy design, available seats should be an enquiry on the Bookingtable! while using a trigger spit may fix this issue the design should be fixed to remove the need for a trigger spit
Never underestimate the power of human stupidity RAH
-
Hi prabu, Want to update the Remaining seats in the another table. So I used @RMNGSTS as variable. How to frame the entire queries? Is the above is correct?
-
Hi, You need to insert same details to another table right, Use same Same logic. No need to assign a values in variable.
-
Friends,, Atlast what is the exact solution? Everybody posting ur concerns, but I want answer:)
Create a stored procedure. Pass the update information into the stored procedure via parameters then update the relevant tables via the stored procedure. I would tend to agree with Mycroft spit that triggers can hide things from you when you are trying to debug a problem later on.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
-
Create a stored procedure. Pass the update information into the stored procedure via parameters then update the relevant tables via the stored procedure. I would tend to agree with Mycroft spit that triggers can hide things from you when you are trying to debug a problem later on.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
One could get the impression that you don't like Mycroft. :laugh:
"The ones who care enough to do it right care too much to compromise." Matthew Faithfull