Results 1 to 4 of 4

Thread: update table

  1. #1
    Join Date
    Sep 2004
    Posts
    3

    Red face Unanswered: update table

    Hi, I need to update certain records in a table. The table has several thousand rows, and I have a list of several hundred record numbers. I need to loop through the table and change any records which have a record number equal to one in my list.

    record number | value
    12 | 45
    13 | 46
    14 | 47
    15 | 48
    16 | 49

    i.e. I would want to loop through and change records 12,15 & 16 all to have a value of 10.
    I have tried several things but they either fall over or create a never ending loop...
    Thanks
    Ed

  2. #2
    Join Date
    Feb 2004
    Posts
    492
    What would be your statement if you had to produce the list or recordnumber's and their new value?

    eg. select recno, count(*) from tab1 group by recno ?

    hook it up to an update, and you're done.

  3. #3
    Join Date
    Sep 2004
    Posts
    3
    Yes its just "select * from tableX", the output is a little more complicated than what I said, but I didnt want to complicate the issue. My problem is having such a large list of record numbers that need to be updated. They are stored in an excel table - is there any way I can load these into some sort of array and then update where a record number is in the array...?
    thanks
    Ed

  4. #4
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    Why of course. From Enterprose Manager click on Tools -> Data Transformation Services -> Import Data. Then pick excel, point to your spreadsheet, and import into a table.

Posting Permissions

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