none
update bulk records in sql server

    Question

  • Hi,

    Im using SQL server 2000 and I have a table called test_table and id is autoincrement.

    I need to update bulk records (10,000) some thing like below update query.

    UPDate test_table set col1 = 'a', col2 = 'b' where id in (1,2,3,4..........10,000)

    is there any way to do this more efficiently?

    Thanks,
    Rakesh.

    Please mark as helpful and propose as answer if you find this as correct!!! Thanks, Rakesh.

    Tuesday, May 22, 2012 12:49 PM

Answers

  • if you are updating just two column you can do it by update command simply as you said id column is identity then you can write update command as below

    UPDate test_table set col1 = 'a', col2 = 'b' where id<=10000

    Tuesday, May 22, 2012 12:53 PM

All replies

  • Hello Rakesh,

    Efficiently in which way? Performance, required log file size or ... ?


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing

    Tuesday, May 22, 2012 12:52 PM
  • if you are updating just two column you can do it by update command simply as you said id column is identity then you can write update command as below

    UPDate test_table set col1 = 'a', col2 = 'b' where id<=10000

    Tuesday, May 22, 2012 12:53 PM