Update 3 columns in a table

  • i have a table with many columns. I just want to update 3 columns in that with the value provided by the user.

    how do i do it rather doing lot of update statement?

    Thanks

  • update mytable

    set column1=value1

    ,column2=value2

    ,column3=value3

    where pkid=recordtoupdateid ?

  • It will help if you give more description of what it is you are trying to do so that we do not end up helping you destroy your table. First, give a look at the UPDATE article in books online. Pay particular attention to the SET clause and the WHERE clause.

    In addition to that, you have three columns and you were wanting to set the three columns to "the value" provided by the user. Is it that you want to assign the same "the value" to all three columns in the table? The answer to this question will impact your SET clause. Also, are you wanting to do this for all rows in the table or only certain specific rows in the column? The answer to this question will impact your WHERE clause or whether or not you have a WHERE clause.

    Edit:

    What you will end up coding ought to look similar to what Jo has given.

Viewing 3 posts - 1 through 2 (of 2 total)

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