How can I change the query result''s data?

  • Hello All,

    I wrote a Select query and got about 500 records out of 15000 records, then I want to update those 500 records one by one manually.

    Can I just update those 500 records in the query result window directly rather than go back to the original table and find out those 500 out of 15000?

    I find I am not allowed to change the data inside the query result window, is there any way that can let me change it there?

    Thanks a lot!

    Henry

  • why can't you update them in the query results window?  is this a permission problem/issue?


    Cheers,

    david russell

  • You cannot make changes to the data from the 'results pane'. The easiest way would be to re-write your select statement into an update statement.

    Alternatively, if you perform the same query through Enterprise Manager, you are able to edit the results.

     

  • You can edit directly in EM (as Paul) suggested but you'd be better off seeking help with your update statement and doing it in one fell swoop rather than manually updating each row..too painful and leaves the door open for user-errors - also not using sql server to your advantage -







    **ASCII stupid question, get a stupid ANSI !!!**

  • Hello David, Paul and Sushila,

    The query result pane under the query window in Enterprise Manager doesn't allow me to edit any cell. I can click into any cell, but when I try to edit, it pops me a small message: "cannot edit this cell".

    And that's just my question: how to edit the query result pane in EM?

    You may have a try. I can't go through it. If you can, tell me how.

    In Query Analyser it doesn't allow me to edit either.

    I am trying to think out how to write a update query, but as it might involve query loop & if..then, it looks complicated too.

    Thanks for your suggestions!

    Henry

  • The most directly way is writing an update query in the Query Analyser.

    The syntax is:

    UPDATE tablename

    SET FieldName = FieldValue [,FieldxName = FieldxValue]

    WHERE wherecondition

    The wherecondition is the same as you used for your Select-query;

    Success,

    Danny

  • Henry,

    Why don't you post the "select" that gets you your 500 rows as well as itemise the updates you want done...

    However complicated it is, I am +ve that someone here will have a solution for you - there're so many SQL giants on this site - you can only benefit from their expertise...







    **ASCII stupid question, get a stupid ANSI !!!**

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply