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
 Other SQL Server 2008 Topics
 Trigger create

Author  Topic 

jnovy
Starting Member

1 Post

Posted - 2012-12-15 : 07:38:05
I would like to create a trigger on a file (Shop Number) to discipline the relation data between two fields [Closing Date] and [Open]. If [Open] is true then [Closing Date] is NULL. If [Open] is false then [Closing Date] contains a datetime.

Would soneone help me with the code for this trigger? I am new at triggers.

Thanks,

Jim Novy

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-15 : 12:35:54
sound like a check constraint to me

ALTER TABLE SHopNumber ADD CONSTRAINT Chk_ClosingDate CHECK ([Closing Date] IS NOT NULL OR [Open] = 1)


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

Go to Top of Page
   

- Advertisement -