guys i have a programming question i have table called prerequsites
which is like this
prerequisite component component
a b
so inside my before insert trigger i have to check if the prerequisite is a valid entry like for instance
an entry like b is a prerequisite component for component a which is not a valid entry since i already have an entry in the prerequisite table which defines that comonent a is a prerequisite of b. however this is
very basic so i can test it easy some thing like this in my before insert
prerequisite component component
a b
b a ( Not a valid entry)
select count(*) from prerequisite where component = value of prerequisite component
and prerequisite component = value of component
the above select statement will actually tell me if entry is allowed for insert and does not override other prerequsites
but it can get very complex depending on how the user chooses so if someone can tell me a nice algorithm or good logic to approach this problem it would be great like for instance
prerequisite component component
a b
b c
c a ( Not a valid entry. so how do i ensure that this entry is not allowed considering that complexity for prerequsites can increase quite greatly)
please can someone tell me how to approach this problem.
Try these links for INSTEAD OF Triggers, you can do things within the Trigger. Hope this helps.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlpro01/html/sql01a17.asp
http://www.databasejournal.com/features/mssql/article.php/1437741
No comments:
Post a Comment