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
 General SQL Server Forums
 New to SQL Server Programming
 insteat of insert

Author  Topic 

loreel
Starting Member

2 Posts

Posted - 2012-12-15 : 16:04:56
Hi ,please i wanna help.
is that Correct?
i wanna check that the woman didn't married before the start date that i wanna to insert.....
Create TRIGGER [dbo].[trig_Couple]
ON [dbo].[Couple]
instead of INSERt
AS
Begin
Insert Couple(CoupleId,HusbandPersonId,WifePersonId,Startdate,EndDate)
Select c1.CoupleId,c1.HusbandPersonId,c1.WifePersonId,c1.Startdate,c1.EndDate
from Inserted c1
inner join Couple c2
on
c1.WifePersonId = c2.WifePersonId
where(c2.EndDate) < (c1.Startdate)

End

i am student at technology university

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2012-12-16 : 02:12:18
Why do you want to do this via a TRIGGER?

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -