Sql Trigger For Timeout

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • baju123
    New Member
    • Jun 2007
    • 9

    Sql Trigger For Timeout

    How do i call an sql trigger when an insert has not happened in a table for a time. I want to call a trigger when the timeout had happened.

    If such a trigger is not possible is there any other way to implement something close this ? somebody please give me a solution
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    Originally posted by baju123
    How do i call an sql trigger when an insert has not happened in a table for a time. I want to call a trigger when the timeout had happened.

    If such a trigger is not possible is there any other way to implement something close this ? somebody please give me a solution

    is your project is web based Application?

    Comment

    • baju123
      New Member
      • Jun 2007
      • 9

      #3
      Originally posted by hariharanmca
      is your project is web based Application?
      No. It is not a web based applicaation. so a NO INSERT Trigger is not possible ?

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32662

        #4
        Which version of SQL Server - 2000 or 2005?
        Just so I know where to look.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32662

          #5
          Try this MSDN link.

          Comment

          • hariharanmca
            Top Contributor
            • Dec 2006
            • 1977

            #6
            Originally posted by baju123
            No. It is not a web based applicaation. so a NO INSERT Trigger is not possible ?
            It is possible. you said timeout, So not mensioned. is it Server timeout are Application Timeout..etc.
            I think NeoPa gave some refrence pages.
            that will help you.

            Comment

            • baju123
              New Member
              • Jun 2007
              • 9

              #7
              Originally posted by hariharanmca
              It is possible. you said timeout, So not mensioned. is it Server timeout are Application Timeout..etc.
              I think NeoPa gave some refrence pages.
              that will help you.
              hi Neo and hari .thanks for your replies.

              I am using sql 2005. I searched in the link you gave me. i couldn't find a trigger that is needed.

              here is the scenario,


              I want to call an sql trigger on a NO INSERT condition on a table for a given time(i want a trigger to be executed when no rows has been inserted in a table for 2 seconds). It is just opposite to TRIGGER ON INSERT. I need one which should be TRIGGER ON NO INSERT for a give timeout interval.

              The timeout is what i define. it is not the server timeout.

              Now i have one more idea. How will i execute a sql code in a procedure every 2 seconds(time may even be in milliseconds). Can i loop a code every 2 seconds. Can you help me on this ?

              Thank you once again for taking time to reply.

              Comment

              • hariharanmca
                Top Contributor
                • Dec 2006
                • 1977

                #8
                Originally posted by baju123
                Now i have one more idea. How will i execute a sql code in a procedure every 2 seconds(time may even be in milliseconds). Can i loop a code every 2 seconds. Can you help me on this ?

                Thank you once again for taking time to reply.
                No, what is your idea is wrong. (can you just think how many two seconds are there in a Day, Month, Year. Then what will be the row count?)


                can you explain, why you are going to do that?

                Comment

                • baju123
                  New Member
                  • Jun 2007
                  • 9

                  #9
                  Originally posted by hariharanmca
                  No, what is your idea is wrong. (can you just think how many two seconds are there in a Day, Month, Year. Then what will be the row count?)


                  can you explain, why you are going to do that?
                  It is like i want to loop based on time as the critieria. instead of saying i = 500

                  while(i > 0)
                  i--;

                  i will say

                  while(time has elapsed)
                  {
                  // this will be executed every time the timeout has elapsed.
                  execute code;
                  }

                  can i do this loop in sql

                  what are all the time related operations available ?

                  Comment

                  • hariharanmca
                    Top Contributor
                    • Dec 2006
                    • 1977

                    #10
                    Originally posted by baju123
                    It is like i want to loop based on time as the critieria. instead of saying i = 500

                    while(i > 0)
                    i--;

                    i will say

                    while(time has elapsed)
                    {
                    // this will be executed every time the timeout has elapsed.
                    execute code;
                    }

                    can i do this loop in sql

                    what are all the time related operations available ?
                    i think you are not in the correct way. I want to know your Requirement of this process. Then we can suggest better.

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32662

                      #11
                      Originally posted by baju123
                      hi Neo thanks for your reply.

                      I am using sql 2005. I searched in the link you gave me. i couldn't find a trigger that is needed.

                      here is the scenario,


                      I want to call an sql trigger on a NO INSERT condition on a table for a given time(i want a trigger to be executed when no rows has been inserted in a table for 2 seconds). It is just opposite to TRIGGER ON INSERT. I need one which should be TRIGGER ON NO INSERT for a give timeout interval.

                      Now i have one more idea. How will i execute a sql code in a procedure every 2 seconds(time may even be in milliseconds). Can i loop a code every 2 seconds. Can you help me on this ?

                      Thank you once again for taking time to reply.
                      Baju PMed me with this information which I've copied into the thread where it belongs.

                      Comment

                      • NeoPa
                        Recognized Expert Moderator MVP
                        • Oct 2006
                        • 32662

                        #12
                        I can't be much more help I'm afraid. I don't get much into SQL Server nowadays. What I can say though :
                        • There is an INSERT trigger. You can use this to reset any timer or delay process you implement.
                        • I would strongly advise against using looping code to handle delays (especially, but not restricted to) in server software. This could have a very serious impact on the performance of the PC as a whole.
                        • I'm afraid I really know very little about what methods or procedures are available to schedule or manage delays / timeouts etc in SQL Server.

                        Comment

                        • baju123
                          New Member
                          • Jun 2007
                          • 9

                          #13
                          Originally posted by NeoPa
                          I can't be much more help I'm afraid. I don't get much into SQL Server nowadays. What I can say though :
                          • There is an INSERT trigger. You can use this to reset any timer or delay process you implement.
                          • I would strongly advise against using looping code to handle delays (especially, but not restricted to) in server software. This could have a very serious impact on the performance of the PC as a whole.
                          • I'm afraid I really know very little about what methods or procedures are available to schedule or manage delays / timeouts etc in SQL Server.
                          Thanks Neo for the information

                          Comment

                          • NeoPa
                            Recognized Expert Moderator MVP
                            • Oct 2006
                            • 32662

                            #14
                            No problem. I'm pleased if it was any help to you :)

                            Comment

                            Working...