Loading ...
Sorry, an error occurred while loading the content.

RE: Subject: [SQLQueriesNoCode] Hello Group please could anyone help me in MSSQL Trigger

Expand Messages
  • John Warner
    Could you give us the wording used by your instructor for this assignment. Something is being lost in your interpretation of the assignment and you are
    Message 1 of 5 , May 16, 2006
    • 0 Attachment
      Could you give us the wording used by your instructor for this
      assignment. Something is being lost in your interpretation of the
      assignment and you are actually not all that clear.

      John Warner


      > -----Original Message-----
      > From: SQLQueriesNoCode@yahoogroups.com
      > [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of Anand Singh
      > Sent: Tuesday, May 16, 2006 8:05 PM
      > To: SQLQueriesNoCode@yahoogroups.com
      > Subject: Subject: [SQLQueriesNoCode] Hello Group please could
      > anyone help me in MSSQL Trigger
      >
      >
      > Subject: [SQLQueriesNoCode] Hello Group please could anyone
      > help me in MSSQL Trigger Hi All, please could anyone tell me
      > how i can call a procedure in sql server 2000 Trigger - here
      > is my requirement, i want to insert some record in table A
      > and when i insert record in that then a trigger should fire
      > which will call a stored procedure which will take data as
      > parameter and that parameter that procedure will take from
      > that calling trigger, so if anyone could provide sample code
      > then would be very good and really thanks a lot to you all.
      > Thanks Roger.
      >
      >
      > [Non-text portions of this message have been removed]
    • Anand Singh
      Hi Everyone please i want to call one stored procedure through trigger in MS SQL Server 2000, the things is that i want to to call after insert trigger which
      Message 2 of 5 , May 19, 2006
      • 0 Attachment
        Hi Everyone
        please i want to call one stored procedure through trigger in MS SQL Server
        2000, the things is that i want to to call after insert trigger which is
        bind on table xyz and when any records inserted in table xyz then the
        trigger will be fired and then call one procedure and inside that procedure
        i want to search anoth table i mean scan another table and see if this match
        found there and if match found there for what ever user - let's say it gets
        5 matching user then my procedure should insert a new row in anothe rtavle
        for all matching user who all found in matching table - the problem is that
        i am able to fire the rigger and also scan but i don't know how to loop
        through in sql with my those values - please anyone help me if you have full
        code for this scenario please.
        Thanks
        Roger


        [Non-text portions of this message have been removed]
      • John Warner
        Not specifically to your problem as I still don t quite understand all of it, but here is how to loop USE Northwind DECLARE @counter int SELECT @counter =1
        Message 3 of 5 , May 19, 2006
        • 0 Attachment
          Not specifically to your problem as I still don't quite understand all
          of it, but here is how to loop

          USE Northwind
          DECLARE @counter int
          SELECT @counter =1
          While @counter < 10
          Begin
          SELECT ProductName
          FROM Products
          WHERE ProductID = @Counter
          SELECT @counter = @counter + 1
          End

          Keywords to use read about in Books Online:
          While
          Begin
          End

          John Warner


          > -----Original Message-----
          > From: SQLQueriesNoCode@yahoogroups.com
          > [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of Anand Singh
          > Sent: Friday, May 19, 2006 5:24 AM
          > To: SQLQueriesNoCode@yahoogroups.com
          > Subject: Re: Subject: [SQLQueriesNoCode] Hello Group please
          > could anyone help me in MSSQL Trigger
          >
          >
          > Hi Everyone
          > please i want to call one stored procedure through trigger in
          > MS SQL Server 2000, the things is that i want to to call
          > after insert trigger which is bind on table xyz and when any
          > records inserted in table xyz then the trigger will be fired
          > and then call one procedure and inside that procedure i want
          > to search anoth table i mean scan another table and see if
          > this match found there and if match found there for what
          > ever user - let's say it gets 5 matching user then my
          > procedure should insert a new row in anothe rtavle for all
          > matching user who all found in matching table - the problem
          > is that i am able to fire the rigger and also scan but i
          > don't know how to loop through in sql with my those values -
          > please anyone help me if you have full code for this scenario
          > please. Thanks Roger
          >
          >
          > [Non-text portions of this message have been removed]
          >
          >
          >
          > ------------------------ Yahoo! Groups Sponsor
          > --------------------~-->
          > Home is just a click away.  Make Yahoo! your home page now.
          > http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/m7folB/TM
          >
          > --------------------------------------------------------------
          > ------~->
          >
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
        • Arti Gupta
          hi, u can do like this i m sending u a sample piece of code Regards Arti Gupta IF @DispatchListType=1 BEGIN DECLARE @DelArticleSKU nvarchar(60), @DelQty
          Message 4 of 5 , May 24, 2006
          • 0 Attachment
            hi,
            u can do like this
            i m sending u a sample piece of code
            Regards
            Arti Gupta
            IF @DispatchListType=1
            BEGIN
            DECLARE @DelArticleSKU nvarchar(60), @DelQty axdtMONEY,@DelUOM axdtCODE
            DECLARE UpdateSKU_Cursor CURSOR FOR
            Select loxSTOCK.ArticleSKU,-loxSTOCK.StockQty,loxSTOCK.UOMCode from loxSTOCK (NOLOCK),loxPICKINGLISTDETAIL p(NOLOCK),loxDISPATCHLISTDETAIL(NOLOCK)
            Where p.PickingListID=loxDISPATCHLISTDETAIL.PickingListID
            AND p.PickingListDetailID=loxSTOCK.PickingListDetailID
            AND loxDISPATCHLISTDETAIL.DispatchListID = @DispatchListId
            OPEN UpdateSKU_Cursor

            -- Perform the first fetch.
            FETCH NEXT FROM UpdateSKU_Cursor INTO @DelArticleSKU,@DelQty,@DelUOM

            -- Check @@FETCH_STATUS to see if there are any more rows to fetch.
            WHILE @@FETCH_STATUS = 0
            BEGIN
            Select @DelQty
            IF @DispatchListType=1
            BEGIN
            EXEC dbo.axspUPDATESTOCK @DelArticleSKU,@DelQty ,@DelUOM
            End
            FETCH NEXT FROM UpdateSKU_Cursor into @DelArticleSKU,@DelQty,@DelUOM
            END

            CLOSE UpdateSKU_Cursor
            DEALLOCATE UpdateSKU_Cursor
            DELETE from loxSTOCK WITH (ROWLOCK)
            FROM
            loxPICKINGLISTDETAIL p(NOLOCK),loxDISPATCHLISTDETAIL(NOLOCK)
            Where p.PickingListID=loxDISPATCHLISTDETAIL.PickingListID
            AND p.PickingListDetailID=loxSTOCK.PickingListDetailID
            AND loxDISPATCHLISTDETAIL.DispatchListID = @DispatchListId
            End

            Anand Singh <rogermoore2006@...> wrote:
            Hi Everyone
            please i want to call one stored procedure through trigger in MS SQL Server
            2000, the things is that i want to to call after insert trigger which is
            bind on table xyz and when any records inserted in table xyz then the
            trigger will be fired and then call one procedure and inside that procedure
            i want to search anoth table i mean scan another table and see if this match
            found there and if match found there for what ever user - let's say it gets
            5 matching user then my procedure should insert a new row in anothe rtavle
            for all matching user who all found in matching table - the problem is that
            i am able to fire the rigger and also scan but i don't know how to loop
            through in sql with my those values - please anyone help me if you have full
            code for this scenario please.
            Thanks
            Roger


            [Non-text portions of this message have been removed]



            SPONSORED LINKS
            C programming language Computer programming languages Java programming language The c programming language C programming language Concept of programming language

            ---------------------------------
            YAHOO! GROUPS LINKS


            Visit your group "SQLQueriesNoCode" on the web.

            To unsubscribe from this group, send an email to:
            SQLQueriesNoCode-unsubscribe@yahoogroups.com

            Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


            ---------------------------------





            ---------------------------------
            Yahoo! India Answers Share what your know-how and wisdom
            Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download now

            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.