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 2008 Forums
 SQL Server Administration (2008)
 trigger

Author  Topic 

programer
Posting Yak Master

221 Posts

Posted - 2012-03-18 : 18:05:13
Hi,

For examples I want to show what I mean with triggers.

I have two tables:

- tbl_BetSlipDetails:
Id, ,Stake, Winnings,
1, 15.00, 0.00


- tbl_BetSlipEvents
Id, BetSlipEventsId, IsWinning
1, 1, false
2, 1, false
3, 1, false


I use join for tables: tbl_BetSlipDetails.Id join with tbl_BetSlipEvents.BetSlipEventsId

As soon as the table value of "true" I need to use trigger to be recorded in the database winnings = 15.00

Like this:

Id, ,Stake, Winnings,
1, 15.00, 15.00


- tbl_BetSlipEvents
Id, BetSlipEventsId, IsWinning
1, 1, true
2, 1, true
3, 1, true

If is one value is "false" the winnings = 0.00

Can you please help me how to use trigger for my solution?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-19 : 00:22:30
you want update to be done at real time?
Also again after true record it a false one comes it should be 0?



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -