Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Tricky question ob querys, how to solve ???

Tricky question ob querys, how to solve ???

Scheduled Pinned Locked Moved Database
questionsharepointdatabasetutorial
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    karam chandrabose
    wrote on last edited by
    #1

    In a Stored Procedure sp { ... .. Query1 Query2 Query3 .... .. } Here in the above storedprocedure the Query2 should be exceuted whenever the Query1 fails and Query3 should be executed invariable the above condition.

    K P 2 Replies Last reply
    0
    • K karam chandrabose

      In a Stored Procedure sp { ... .. Query1 Query2 Query3 .... .. } Here in the above storedprocedure the Query2 should be exceuted whenever the Query1 fails and Query3 should be executed invariable the above condition.

      K Offline
      K Offline
      Karma31251
      wrote on last edited by
      #2

      its been a long time since i programmed in C# but you could do this try { query1 catch try { query2 catch try { query3 catch messageBox(error) } } } Something to that effect.

      C 1 Reply Last reply
      0
      • K karam chandrabose

        In a Stored Procedure sp { ... .. Query1 Query2 Query3 .... .. } Here in the above storedprocedure the Query2 should be exceuted whenever the Query1 fails and Query3 should be executed invariable the above condition.

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        Inside your stored procedure you could do the following:

        INSERT INTO ... (Query 1)
        IF @@Error <> 0
        BEGIN
          INSERT INTO .... (Query 2)
        END
        
        UPDATE ... (Query 3)
        

        the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
        Deja View - the feeling that you've seen this post before.

        K 1 Reply Last reply
        0
        • K Karma31251

          its been a long time since i programmed in C# but you could do this try { query1 catch try { query2 catch try { query3 catch messageBox(error) } } } Something to that effect.

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          He wanted to do all that in a stored procedure.


          Upcoming Scottish Developers events: * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

          1 Reply Last reply
          0
          • P Pete OHanlon

            Inside your stored procedure you could do the following:

            INSERT INTO ... (Query 1)
            IF @@Error <> 0
            BEGIN
              INSERT INTO .... (Query 2)
            END
            
            UPDATE ... (Query 3)
            

            the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
            Deja View - the feeling that you've seen this post before.

            K Offline
            K Offline
            karam chandrabose
            wrote on last edited by
            #5

            Yes i wanted to do it all in Stored procedure, Thanks a lot Pete

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups