Need urgent help

  • Hey guys,

    I am facing some prob. In my sql server stored procedure i am creating table having column c1, c2, etc.. I am getting one value from the database and depending on that value, e.g if 1, i would like to update c1 and like so.

    How to do that ....can u help..

    thanks for your time.

     

  • Why can't you create different stored procs for different update statements?

  • Thanks for your time...but I have about 30columns of that kind so it is not feasible to create 30 store proc for each column.

    any other idea? thank for your time.

  • Create a bit flag for each column that may need to be updated and use an update statement similar to this:


    update YourTable

      set col1 =

      case

         when(@col1_change=1) then @new_col1_val

         else col1

      end,

      col2 = ...


  • Thank you for the idea. Do we have something in sql server to access any column using the index value like we do in c# or vb.

    thanks..

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

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