Results 1 to 4 of 4
  1. #1
    Join Date
    May 2010
    Posts
    52

    Unanswered: best way to update a column?

    so i have a table with 25million rows. this table has an image data type column and i want to set this column to null. what is the most efficient way to archive my goal. SQL SERVER 2008

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    I don't understand the question. What is wrong with:
    Code:
    update the_table
       set the_column = null;
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Slight amends
    Code:
    UPDATE the_table
    SET    the_column = NULL
    WHERE  the_column IS NOT NULL
    ;
    George
    Home | Blog

  4. #4
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    might be faster to drop and readd the column.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

Posting Permissions

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