Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 trigger

Author  Topic 

programer
Posting Yak Master

221 Posts

Posted - 2011-04-27 : 09:34:56
ALTER TRIGGER InsertTrigger
ON tbl_BettingSlipInfo
AFTER INSERT
AS

BEGIN

INSERT into tbl_UserTransaction(UserId, TransactionAmount)
VALUES ('s', ('10'))

END

In the table tbl_UserTransaction I would like saved data from tbl_BettingSlipInfo.

tbl_BettingSlipInfo:
UserId

tbl_UserTransaction:
UserId

When I saved UserId, are data stored in tbl_UserTransaction


Please help

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-04-27 : 09:41:31
ALTER TRIGGER InsertTrigger
ON tbl_BettingSlipInfo
AFTER INSERT
AS

BEGIN
INSERT into tbl_UserTransaction(UserId, TransactionAmount)
select UserID, Amount
from inserted
END

see
http://www.nigelrivett.net/SQLTriggers/Triggers_1_A_beginners_guide.html


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -