retreve number of records updated

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default retreve number of records updated

    is there a variable that can be accessed from a query that tells the number of records updated?
    Thanks
    KES

    theAgencyMan Guest

  2. Similar Questions and Discussions

    1. GridView reload for the updated records.
      Hi Is there any way that I can call a vb function from Javascript ......... Scenario I have a search which shows output in a gridview. I have...
    2. Total number of records
      When I do a query, how do I get a total number of records found to appear at the bottom of the screen? Thanks
    3. Display x number of records
      How could I display *only* x# of records even if the select statement returns a value >x?
    4. Illustrator CS Serial Number Issues -- Adobe response - Updated!
      We waited 2 weeks for them to respond back at my office before having no one call us back or email us as promised. Every phonecall created no...
    5. number of records
      hello sir, thank u for help in advance i want to know as to how i can get the number of records obtained in the result of a select query ,the...
  3. #2

    Default Re: retreve number of records updated

    the query won't report back

    you can keep track on your end, but you will only know how many you EXPECTED
    to update, not how many you actually updated

    if you trap the update statement(s) for errors, and do them one at a time
    while keeping a counter, then you can keep track

    otherwise, you could do a stored procedure that keeps count of the updated
    records and returns a total

    TurboMini Guest

  4. #3

    Default Re: retreve number of records updated

    In SQL server you have the variable @@ROWCOUNT, that returns the number of rows
    affected by the last SQL instruction. If you are running other DB, surely
    there's a variable for that purpose.

    UPDATE table SET column = value
    WHERE column = value1

    IF @@ROWCOUNT = 0
    print 'Warning: No rows were updated'
    ELSE
    print str(@@ROWCOUNT)

    REgards

    Sojovi Guest

  5. #4

    Default Re: retreve number of records updated

    Run a select count(something) before your update. As long as the where clauses are the same, you will get your answer.
    Dan Bracuk Guest

  6. #5

    Default Re: retreve number of records updated

    THanks , that's what i was looking for

    theAgencyMan Guest

Posting Permissions

  • You may not post new threads
  • You may 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