Results 1 to 12 of 12

Thread: Trigger help..

  1. #1
    Join Date
    Apr 2004
    Posts
    101

    Unanswered: Trigger help..

    Hi,
    Could anyone please help me in creating trigger..
    here is my requirement..
    i have a table with 3 columns, whenever column 2 inserted trigger has to update/insert column 3 with column 2 data. In otherwords i have to maintain same data in two columns, but 3 rd column should be populated automatically.
    Thanks in advance..
    ss

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    You must be joking.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I need to create a trigger to show me all of the redundant data I have...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    That's really more of a job for dynamic sql, don't you think?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by blindman
    That's really more of a job for dynamic sql, don't you think?
    With a cursor, of course!

    -PatP

  6. #6
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    A dynamic nested cursor.....

    http://www.dbforums.com/t1000504.html
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  7. #7
    Join Date
    Apr 2004
    Posts
    101
    I got it through trigger..
    thanks guys..

  8. #8
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    You never told us what practical application this has?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  9. #9
    Join Date
    Sep 2003
    Location
    New York, NY
    Posts
    136

    Talking

    third column must be a backup of the second column...in case something happens to the second one...

  10. #10
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Oh my God.

    Why stop there? Add a dozen more columns and then you have REAL security.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  11. #11
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Or for real security you could create a "shadow table", with an additional table to act as a queue to hold the pending updates for N minutes before you apply them to the "shadow", just in case you discovered a problem that you needed to back out an hour or two later!

    -PatP

  12. #12
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    You might also try a HISTORY TABLE.
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •