locked
Update Issue RRS feed

  • Question

  • I have an Update statement but i want to update many columns with one statement can I do that?? my statement should look like this

     

    Update table SET [column, column, column, column, column] = '" + txtbox.text + "' 

     

    how would i do this, Could i use an insert, but i want to access the info again to make a change so thats why i used the update, but having issues getting it right......any help would be fantastic! 

    Tuesday, March 21, 2006 2:16 PM

Answers

  • You can't use that type of syntax. 

    Update Table

    Set ColumnA = 'a', ColumnB = 'b', ColumnC = 'c'.....

    WHERE.....

     

     

    Tuesday, March 21, 2006 2:22 PM
  • Update table SET column1 = '" + txtbox1.text + "',

    column2= '" + txtbox2.text + "',

    column3, = '" + txtbox3.text + "' 

    where some field = some condition

     

    this is the general idea, modify for your own use

     

    Denis the SQL Menace

    http://sqlservercode.blogspot.com/

    Tuesday, March 21, 2006 2:22 PM

All replies

  • You can't use that type of syntax. 

    Update Table

    Set ColumnA = 'a', ColumnB = 'b', ColumnC = 'c'.....

    WHERE.....

     

     

    Tuesday, March 21, 2006 2:22 PM
  • Update table SET column1 = '" + txtbox1.text + "',

    column2= '" + txtbox2.text + "',

    column3, = '" + txtbox3.text + "' 

    where some field = some condition

     

    this is the general idea, modify for your own use

     

    Denis the SQL Menace

    http://sqlservercode.blogspot.com/

    Tuesday, March 21, 2006 2:22 PM