Hallo,

wenn das bei dem usw. strukturell genauso weiter geht, dann lässt sich das mit:

update mytable
set myColumn = :myColumn
where
column1 between :low1 and :high1
and column2 between :low2 and :high2

sogar als statisches SQL lösen.
wenn dann eine Bedingung für columnX ausfallen soll, dann besetzt man lowX mit loval und highX mit highval

mfg

Dieter Bender

udate
Zitat Zitat von CrazyJoe Beitrag anzeigen
Hallo,

nachfolgende SR erzeugt mir jetzt das UPDATE-Statement mit der Where-Klausel.

MfG,

Joe

PHP-Code:
       begsr crt_updstmt;

          
// --- SQL-statement löschen -----------------------------------------------------------
          
reset sqlstmt;
          
// Update-Statement übernehmen
          
sqlstmt 'UPDATE Datei set Wert1 = ' + %char(Hostvar1) + ', ' +
                    
'Wert2 = ' + %char(Hostvar2) + ', Wert3 = ' c_HC +  
                    
Hostvar3 c_HC ', ' 'Wert4 = ' + %char(Hostvar4);

          
§where = *off;

          
// Where-Bedingung an Update  anfügen
          
if where1 <> ' ' and
             
where1 <> '***';
            if 
§where = *off;
              
sqlstmt = %trim(sqlstmt) + ' ' c_where +
                        
' where1 = ' c_HC Hostvar5 c_HC;
              
§where = *on;
            else;
              
sqlstmt = %trim(sqlstmt) + ' ' c_and +
                          
' where1 = ' c_HC Hostvar5 c_HC;
            endif;
          endif;

          if 
where2 <> 0;
            if 
§where = *off;
              
sqlstmt = %trim(sqlstmt) + ' ' c_where +
                        
' where2 = ' c_HC + %char(Hostvar6) + c_HC;
              
§where = *on;
            else;
              
sqlstmt = %trim(sqlstmt) + ' ' c_and +
                          
' where2 = ' c_HC + %char(Hostvar6) + c_HC;
            endif;
          endif;

          
//usw,...
      
       
endsr