Unanswered: Create sql statement dynamically in stored procedure (sybase 15.5)
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
declare @query varchar(255)
@query = "update my_table set "
if (in_set_col = 1)
@query += " col1 = @in_col1"
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.