Hello All,

I am going to rephrase my question from 2 weeks ago. Is it possible to dynamically create, say, an update statement from within a stored procedure. For instance, if I have a table with col1, col2, col3, col4 and I want to call a stored procedure to update various combinations of those columns, could I do this?

e.g. (syntax is probably not correct)

create procedure my_procedure
  in_col1       char(10),
  in_col2       int,
  in_col3       char(5),
  in_col4       varchar(32)
  in_set_col_1  int,
  in_set_col_2  int,
  in_set_col3   int,
  in_set_col4   int
   declare @query varchar(255)

   @query = "update my_table set "
   if (in_set_col = 1)
      @query += " col1 = @in_col1"
   exec @query

Is this possible in any way? I am not a stored procedure expert by any means. My issue is that when I use the Sybase C interface to run the update query by hand (not in a stored procedure) it is very time consuming. I am hoping putting that logic in a stored procedure gives me better performance.