Professional Web Applications Themes

Cursor - Microsoft SQL / MS SQL Server

Cursor is a best solution in the following situation. You want to execute a long running update or delete query and want to allow the users to access the table while the query is running. If you don't use a cursor and execute a long running Delete or Update query, you will lock the table and the users will not be able to access the table. In this situation your best option would be to use a cursor along with the ROWLOCK queryhint and transaction ISOLATION LEVEL. As far as I know this is the only situation where you should ...

  1. #1

    Default Re: Cursor

    Cursor is a best solution in the following situation.
    You want to execute a long running update or delete query and want to allow
    the users to access the table while the query is running. If you don't use a
    cursor and execute a long running Delete or Update query, you will lock the
    table and the users will not be able to access the table. In this situation
    your best option would be to use a cursor along with the ROWLOCK queryhint
    and transaction ISOLATION LEVEL.

    As far as I know this is the only situation where you should use a cursor.
    In other situations,you can and should always try to use table variable or a
    temporary table instead of a cursor. I may be wrong. So you should also read
    what other people say in their response.

    "Adam Right" <tt.com> wrote in message
    news:%phx.gbl... 


    Nikhil Guest

  2. #2

    Default Re: Cursor

    >> Could you please explain me the T-Sql Cursors ? <<

    Read the manual; why should anyone post the entire description from the
    BOL for you?
     [/ref]

    To convert a result set into a sequential file structure.

    --CELKO--
    ===========================
    Please post DDL, so that people do not have to guess what the keys,
    constraints, Declarative Referential Integrity, datatypes, etc. in your
    schema are.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Joe Guest

  3. #3

    Default Re: Cursor

    My top 5 reasons that people use cursors:

    1. Bad grasp of SQL.
    2. Bad database design.
    3. Weird business rules.
    4. You want to execute a stored proc for each row in the result set. This can sometimes be cirvented by a user-defined function (UDF).
    5. Breaking work into chunks.

    --
    Tom

    ---------------------------------------------------------------
    Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
    SQL Server MVP
    Columnist, SQL Server Professional
    Toronto, ON Canada
    www.pinnaclepublishing.com/sql


    "Adam Right" <tt.com> wrote in message news:#phx.gbl...
    Could you please explain me the T-Sql Cursors ?
    What is the purpose of using cursors in any T-Sql Statements

    Thanks.


    Adam Right



    Tom Guest

  4. #4

    Default Re: cursor

    Can you expand on your need a bit? It is not clear what you are trying to do. I understand that you are passing three variables. What record do you want to exclude based on the value of the data within the first variable? Perhaps we would be able to help if you showed us sample data, your cursor, and your expected output based on your input parameters.

    --
    Keith, SQL Server MVP

    "Frank Dulk" <com.br> wrote in message news:phx.gbl... 
    Keith Guest

Similar Threads

  1. Where's the (*&#^ cursor?
    By darrel in forum Macromedia Freehand
    Replies: 0
    Last Post: February 11th, 10:23 PM
  2. cursor
    By > in forum Macromedia Dreamweaver
    Replies: 1
    Last Post: January 13th, 08:11 PM
  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. Without cursor
    By news.siol.net in forum Microsoft SQL / MS SQL Server
    Replies: 4
    Last Post: July 11th, 02:07 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