how to add a column to a table ?

  • How to edit table data in SQL Server Management Studio ?

    I right click on table > Edit top 200 data ---> then I go to cell ---> then I modify data.

    but how do I save this data ? It says data is not committed yet with a red mark.

    I tried clicking Execute SQL button at the top ...but that did not do anything.

  • you want to add column or edit column?

    in edit mode, when you change some value of column red exclamation mark show.

    after changing, only click on the other row of table and data will be changed.

  • May I suggest getting familiar with the UPDATE, INSERT and DELETE statements? That edit data window should not be used in most cases, because it's not how you're going to be manipulating data in SQL Server.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • The first question I have is, why is it necessary to edit the data at all?

    The second question is, why did you choose this manner in which to update it?

    And the last question I have is, what environment are you in? Production? Development? Your own home computer (and you're just playing around)?

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • I never make changes through the GUI. I go through a few steps when modifying data on the fly through a query window.

    1) SELECT the data to be changed to verify it is correct

    2) Save the data first in case there is a mistake and it needs to be recovered

    3) Make the update inside a transaction

    4) Verify the data is correct with a select statement

    5) COMMIT if correct, ROLLBACK if there is a problem

    Try this:

    1)

    select * from table_A where Completed_code = 'Y'

    2)

    select * into Table_A_20130930 from table_A where Completed_code = 'Y'

    3)

    begin tran

    update table_A

    set Processed_code = 'Y'

    where Completed_code = 'Y'

    4) Run select to verify the result

    5)

    rollback or commit

Viewing 5 posts - 1 through 4 (of 4 total)

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