Professional Web Applications Themes

How to exit a Cursor - Microsoft SQL / MS SQL Server

Hi, I have two cursors - an outer and an inner. In the inner cursor, I check for a condition, and if the condition is met, I want get out of both inner and outer cursors and deallocate them. How can I accomplish this ? Thanks a lot for your time !!....

  1. #1

    Default How to exit a Cursor

    Hi,

    I have two cursors - an outer and an inner. In the inner
    cursor, I check for a condition, and if the condition is
    met, I want get out of both inner and outer cursors and
    deallocate them. How can I accomplish this ? Thanks a lot
    for your time !!.
    exBK Guest

  2. #2

    Default Re: How to exit a Cursor

    Or you could use another variable that is set to a particular value when a
    condition meets, and check the variable in the WHILE along with
    FETCH_STATUS

    --
    HTH,
    Vyas, MVP (SQL Server)
    [url]http://vyaskn.tripod.com/[/url]
    What hardware is your SQL Server running on?
    [url]http://vyaskn.tripod.com/poll.htm[/url]




    "exBK" <chikkodi> wrote in message
    news:299901c33f5a$8ee1e000$a601280aphx.gbl...
    I found an answer (use GOTO) .. Thanks.
    >-----Original Message-----
    >Hi,
    >
    >I have two cursors - an outer and an inner. In the inner
    >cursor, I check for a condition, and if the condition is
    >met, I want get out of both inner and outer cursors and
    >deallocate them. How can I accomplish this ? Thanks a
    lot
    >for your time !!.
    >.
    >

    Narayana Vyas Kondreddi Guest

  3. #3

    Default Re: How to exit a Cursor

    You DONT want to use GOTO. Use BREAK instead.

    --

    Andrew J. Kelly
    SQL Server MVP


    "exBK" <chikkodi> wrote in message
    news:299901c33f5a$8ee1e000$a601280aphx.gbl...
    > I found an answer (use GOTO) .. Thanks.
    > >-----Original Message-----
    > >Hi,
    > >
    > >I have two cursors - an outer and an inner. In the inner
    > >cursor, I check for a condition, and if the condition is
    > >met, I want get out of both inner and outer cursors and
    > >deallocate them. How can I accomplish this ? Thanks a
    > lot
    > >for your time !!.
    > >.
    > >

    Andrew J. Kelly Guest

  4. #4

    Default Re: How to exit a Cursor

    Avoid usage of GOTO to the maximum as it leads to unstructured code flow and it is difficult to understand ... Use the method Vyas has outlined.

    --
    HTH,
    Vinod Kumar
    MCSE, DBA, MCAD
    SCT Software Solutions

    "exBK" <chikkodi> wrote in message news:299901c33f5a$8ee1e000$a601280aphx.gbl...
    > I found an answer (use GOTO) .. Thanks.
    > >-----Original Message-----
    > >Hi,
    > >
    > >I have two cursors - an outer and an inner. In the inner
    > >cursor, I check for a condition, and if the condition is
    > >met, I want get out of both inner and outer cursors and
    > >deallocate them. How can I accomplish this ? Thanks a
    > lot
    > >for your time !!.
    > >.
    > >
    Vinodk Guest

Similar Threads

  1. Myspace Exit
    By mikejones77 in forum Macromedia Flash Player
    Replies: 0
    Last Post: August 6th, 04:55 AM
  2. [PHP] PHP if exit Q
    By Marek Kilimajer in forum PHP Development
    Replies: 0
    Last Post: August 27th, 11:06 AM
  3. cursor 200-problem on mac but not pc? how to swap cursor image?
    By nickelsock webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 5
    Last Post: August 2nd, 10:58 AM
  4. Cursor enter left, center on text exit--How To??
    By Dirk Goldgar in forum Microsoft Access
    Replies: 1
    Last Post: July 15th, 07:34 PM
  5. Change the "web hand" cursor in normal arrow cursor?
    By FB1976 in forum Adobe Dreamweaver & Contribute
    Replies: 1
    Last Post: July 9th, 07:15 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139