Business rules

Posted on 2005-05-16
Last Modified: 2010-03-19

I've got a scenario in my database whereby the existence of a record in one table SHOULD depend on the existence of another record in another table...e.g When i create a record in 'Table A' i currently create a related record into 'Table B'. I do this because i know that the system needs this record for other events that will take place around the website....the problem is that i know this cause i developed the system, any other DB administrator wouldn't have a clue that this relationship needed to this a business rule that is needed? Is this where i would use a trigger???

Thanks in advance

Question by:higgsy
    LVL 11

    Accepted Solution

    Use of a trigger would help as long as another developer knew it was there. business rules are such that you can make any as long as you document them.

    A trigger is a good solution for now - except that you have to ensure the next bloke knows it is there, knows why it is there and knows how to edit it if necessary.

    a loose relationship like that (that is not enforced by foreign keys) are really tricky to find later on down the road. BUT it is you project and as long as you have sufficient docs the next bloke will be fine.
    LVL 4

    Assisted Solution

    if you are adding records using a stored procedure, which I reccomend. Then you can use your business logic there. you can comment your logic, and  if  you use a trigger, comment it in the stored procedure as well.

    This helps organize your business also.


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now