Results 1 to 12 of 12
  1. #1
    Join Date
    Oct 2008
    Posts
    5

    Unanswered: SSMS - Table Edit Mode

    First of all...

    Hello everybody, I just found this forum and I would appreciate any help I can get.

    Question: One of the minor things I was never able to figure out in SSMS is opening a table in edit mode. I can right click on any table and chose open, but that returns all the data too, which I don't want.

    I have to click the "stop retrieving data" button at the bottom before I can work with the table in edit mode. Once I stop the data flow I can now click on the show SQL pane button and I have what I am used to in Query Analyzer. It almost seems like that is a option that isn't available in 2005

    TIA

    SQL Dev

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Right click it and there's an option for "Return Top..." (or similar, don't have a copy in front of me).

    HTH
    George
    Home | Blog

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    P.S. I have no idea what you mean by "edit mode"
    George
    Home | Blog

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Have you seen the shiny "New Query" button at all btw?
    George
    Home | Blog

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Right-click and select Design (or select Script Table As...).
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  6. #6
    Join Date
    Oct 2008
    Posts
    5

    Talking

    Quote Originally Posted by georgev
    Have you seen the shiny "New Query" button at all btw?
    OK...thanks for making feel like I belong

    What I mean by edit mode is when the data displays in the Results window you can click in a cell and modify the data directly.

    The "shiny" button allows you to query but the results are not in edit mode.

    If you right click on a table listed in the Object Explorer there is no option for "Return Top..."

  7. #7
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Editing data directly in the GUI is generally a bad practice. These are databases, not spreadsheets, and I personally wish that functionality had not been included.
    What editing are you doing that you can't do use query statements?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  8. #8
    Join Date
    Oct 2008
    Posts
    5
    Quote Originally Posted by blindman
    Editing data directly in the GUI is generally a bad practice. These are databases, not spreadsheets, and I personally wish that functionality had not been included.
    What editing are you doing that you can't do use query statements?

    Totally agree that it is not a good practice. Occasionally I will pop into a user table and do a quick one cell modification on a production database. Perhaps someone's username is incorrect so I like edit mode for that.

    I do use scripts like

    Update dbo.User
    Set Username = 'joeuser'
    Where UserID = 1234

    but I often have many scripts like this on the same page (query.sql).

    I once selected a script and ran the update only to realize that I didn't select the Where clause. Man did that suck!

    So now I format my queries on a single line so I can't do that.

    Update dbo.User Set Username = 'joeuser' Where UserID = 1234

    Anywho...I appreciate the feedback

  9. #9
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    off topic a bit: i wonder how that edit mode works if there are dupes in a table with no pk. if you edit a row that is an exact dupe, do both rows change?

    not interested enough to look into it though.

  10. #10
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    I think it works exactly like MS Access, which is to say that with no PK, edits are disabled.

    As for making ad hoc updates more safe, I tend to write out the update or delete statement without the first character, until I actually need to run the query, so it looks something like:
    Code:
    pdate customers
    set discount = 100.0
    where name = 'mcrowley'
    This way, if there is an accidental brain fart, the statement simply throws a syntax error, instead of updating actual data. It's a personal taste, of course.

    EDIT: Fixed code tags.

  11. #11
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    My preference is to wrap it in a rollback transaction.

    First thing I write is
    Code:
    BEGIN TRAN
    
    
    
    ROLLBACK TRAN
    Then I can even see the number of results that would be affected without committing the statement
    George
    Home | Blog

  12. #12
    Join Date
    Jun 2011
    Posts
    1

    Talking SQL 2008 Openin the table in EDIT mode with Filters / WHERE clause

    Quote Originally Posted by SQL Dev View Post
    OK...thanks for making feel like I belong

    What I mean by edit mode is when the data displays in the Results window you can click in a cell and modify the data directly.

    The "shiny" button allows you to query but the results are not in edit mode.

    If you right click on a table listed in the Object Explorer there is no option for "Return Top..."
    Looking at the date, I am guessing that you have probably found your answer. However for people who are still for looking for the answer, I would like to write down what I am doing now.

    1- Right Click on the table and select edit table.
    Now this will only allow you to edit the rows in display without any where clause.
    2-Once the table is displayed on the right pane, right click anywhere, you will get a menu. Click on Pane, click on SQL. You will see the SQL script on top which you can change and add filters to, and you will also see the table in EDIT mode.

    For the people who are worried for messing up with the tables, dont you worry. If you conflick with any primary or foreign key, the application doesnt allow you to update the data.

    I hope this helps for anyone looking for the EDIT mode with select query in SQL 2008.

Posting Permissions

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