July 16, 2008 at 4:44 am
I am wanting to do both with the submitting of a single form. I am working on a baseball application where I need to update a players team but I also want to keep a record of the transaction.
Update
PLAYERS
ID, Team, DateTime
Insert
TRANACTIONS
ID, PlayerID, Team, Action, DateTime
I have never done anything other than a standard update or insert and dont know how to do both in one querry
August 27, 2008 at 10:07 pm
Try using triggers...
you can read it in http://www.sdn.com...
OR
JUST CREATE A STORED PROCEDURE or what we call SPROC (cause i don't use triggers)
something like this (haven't tested code ofr errors but its soething like this)
CREATE PROC SampleStoredProcedure
@ID INT,
@Team VARCHAR(100),
@Datetime Datetime,
@PlayerID,
@Action
AS
BEGIN
Update PLAYERS
SET @ID=ID, @Team=Team, @DateTime=DateTime
Insert Into TRANACTIONS
VALUES(@ID, PlayerID, @Team, Action, @DateTime)
END
RETURN
GO
You can also check out things about Stored Pr5ocedures at http://www.msdn.com
By the way, read also on Transaction (BEGIN,COMMIT,ROLLBACK,etc...)
Hope it helps
_____________________________________________
[font="Comic Sans MS"]Quatrei Quorizawa[/font]
:):D:P;):w00t::cool::hehe:
MABUHAY PHILIPPINES!
August 27, 2008 at 10:35 pm
forget about using a trigger for this. use a proc.
---------------------------------------
elsasoft.org
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply