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