| 
                
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. 
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | programerPosting Yak  Master
 
 
                                        221 Posts | 
                                            
                                            |  Posted - 2014-10-08 : 04:35:48 
 |  
                                            | my tables:tbl_detailsId, Check, 10, 176, 2tbl_system:Id, System, Amount1 10,76 With trigger I want if have Check=2 from tbl_details then and if exists in tbl_system.System=76 insert in Amount 0.00How to do it? |  |  
                                    | programerPosting Yak  Master
 
 
                                    221 Posts | 
                                        
                                          |  Posted - 2014-10-08 : 06:27:51 
 |  
                                          | really you do not know my question? |  
                                          |  |  |  
                                    | programerPosting Yak  Master
 
 
                                    221 Posts | 
                                        
                                          |  Posted - 2014-10-08 : 07:32:34 
 |  
                                          | quote:Check my code... working but problem is because i have in my column SystemBet=1029, 2032 and I need to set=0 when is result updatewin= (SELECT TOP 1 BetSlipEventID  FROM @Odds where IsWinning=2)   in my case is 2032, but now not working because is also 1029... So I need to also use update if my code contains 1029,or etc...if find 2032 then use update...DECLARE @Odds AS Table( SrNo  INT IDENTITY, BetSlipEventID  INT, IsWinning  INT, Odds  FLOAT, SlipSystemId INT, StaKe FLOAT, BetSlipDetailID INT) INSERT INTO @Odds(BetSlipEventID,IsWinning,Odds,SlipSystemId,StaKe,BetSlipDetailID) SELECT CAST(string AS INT) BetSlipEventID,BSE.IsWinning,BSE.Odds,BSS.Id,BSS.Stake,BSS.BetSlipDetailId FROM tbl_BetSlipSystem BSS OUTER APPLY dbo.fnParseStringTSQL(BSS.SystemBet, ',') AS T INNER JOIN tbl_BetSlipEvents BSE ON BSE.BetSlipDetailId=BSS.BetSlipDetailId   AND BSE.ID=CAST(T.string AS INT) INNER JOIN tbl_BetSlipEvents I ON BSE.BetSlipDetailId=I.BetSlipDetailId ORDER BY BSS.Id ASC,IsWinning DESC   declare @updatewin nvarchar(4000) set @updatewin = (SELECT TOP 1 BetSlipEventID  FROM @Odds where IsWinning=2)   --(SELECT TOP 1 BetSlipEventID  FROM @Odds where IsWinning=2)  update tbl_BetSlipSystemset Win =0where SystemBet= @updatewinOriginally posted by programer
 my tables:tbl_detailsId, Check, 10, 176, 2tbl_system:Id, System, Amount1 10,76 With trigger I want if have Check=2 from tbl_details then and if exists in tbl_system.System=76 insert in Amount 0.00How to do it?
 
 |  
                                          |  |  |  
                                |  |  |  |  |  |