SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 trigger
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

programer
Posting Yak Master

Slovenia
221 Posts

Posted - 09/26/2013 :  15:01:25  Show Profile  Reply with Quote
tbl_Events:
Id, DetailId,Date,Event
1838 598 NULL 28.9.2013 11:45:00 Tottenham - Chelsea 3Way - result Tottenham NULL 2,65 0
1839 598 NULL 28.9.2013 14:00:00 Aston Villa - Manchester City 3Way - result Aston Villa NULL 7,00 0
1840 598 NULL 28.9.2013 14:00:00 Fulham - Cardiff City 3Way - result Fulham NULL 2,10 0

tbl_System
Id, BetSlipDetailId, BetSlipEventId,SystemId
2990 598 1838 1838,1839|1838,1840

My code:
--AB
Insert into tbl_BetSlipSystem(BetSlipDetailId,BetSlipEventId,SystemBet)
Select BetSlipDetailId,Id,'AB' from
(Select row_number() over(order by id) as Number, Id,BetSlipDetailId from inserted) as a
Where a.Number IN (1,2|1,3)


So, If I first select row_number 1,2 and then 1,3.

In the table tbl_System I need to insert Id from first table:
1838,1839|1838,1840
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000