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
 General SQL Server Forums
 New to SQL Server Programming
 insteat of insert
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

loreel
Starting Member

Syria
2 Posts

Posted - 12/15/2012 :  16:04:56  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

United Kingdom
2079 Posts

Posted - 12/16/2012 :  02:12:18  Show Profile  Visit jackv's Homepage  Reply with Quote
Why do you want to do this via a TRIGGER?

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
  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.11 seconds. Powered By: Snitz Forums 2000