Results 1 to 3 of 3

Thread: How to avoid time consumption in case of cursor

  1. #1
    Junior Member
    Join Date
    May 2007

    How to avoid time consumption in case of cursor

    In case of cursors where exactly it consumes time and how to avoid it
    For example I have 3500 rows with 165 columns. I need to update all those rows . For this I have taken a SP and passed those all recs as XML parameter to that SP but it is taking around 20 mins time if i run in the query analyzer.

    Suggest an Idea

  2. #2
    Expert Member
    Join Date
    Sep 2006

    Re: How to avoid time consumption in case of cursor

    Well all these things depends on your design. Why would you need XML file to update few rows? Having an XMl isn't the wisest of ideas as reading from file takes quite a bit of time.

    If you do have the information in other tables, writing simple joins or reading from those tables would make more sense. If reading from the XML is a necessity, it is worth loading the XML data into a temporary table and then do the update fetching data from here. Instead of relying on a cursor - update and them again read from XML.

    I might be able to suggest better if you give the exact scenario.


    [COLOR="Blue"][SIZE="2"]"If you are not living on the edge of your life, you are wasting space"[/SIZE][/COLOR]

    Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!"

  3. #3
    Junior Member
    Join Date
    Apr 2007

    Re: How to avoid time consumption in case of cursor

    To avoid you can try using temp tables. Please let me know if i am wrong

  4.  Sponsored Ads


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.