Create trigger for insert new record

Hello everyone.

I need your help for create trigger insert.

Now I use this code ASP for insert new record in the table.

This operation it’s possible with trigger in the Mysql 5.0.45 version?

  
   //QUERY TABLE _TEMP
   SQL = " SELECT * FROM "
   SQL = SQL & " _temp "
        
   Set Rs = CreateObject("ADODB.Recordset")
   Rs.Open SQL, cn
   
   if not Rs.eof then 

         Rs.MoveFirst()
           Do While Not Rs.EOF
         
           //QUERY FOR _TBL
           qs = "SELECT * FROM "
           qs = qs & " _tbl "
           qs = qs & " WHERE 1 "
           qs = qs & " AND DATES = '" & formatGMTDate(RS("DATES"),0,"yyyy-mm-dd") & "' "

           set RSqs = CreateObject("ADODB.Recordset")
           RSqs.Open qs, cn
           
           if not RSqs.eof And not RSqs.bof then
              response.write "Nothing"
           
           else                      
                                
           SQL = "INSERT INTO "  
           SQL = SQL & " _tbl " 
           SQL = SQL & "( "  
           SQL = SQL & "  DATES "
           SQL = SQL & " ) "  
           SQL = SQL & "  VALUES "  
           SQL = SQL & " (  "             
           SQL = SQL & " '" & formatGMTDate(Rs("DATES"),0,"yyyy-mm-dd") & "' "
           SQL = SQL & " ) "  
           cn.execute(sql)     
              
           end if
                      
           RSqs.Close()
           set RSqs = Nothing

         Rs.MoveNext()
      Loop

   Rs.Close()
   Set Rs = Nothing

   cn.Close()
   Set cn = Nothing

perhaps you could explain what this operation is supposed to do?

i can’t figure it out from your code

Ok.

I have two tables in mysql: _temp and _tbl.

I need select all rows of table _temp and if row not exist in the table _tbl, insert the new row in _tbl.

I have to analyze tables _temp and _tbl and insert news rows in the _tbl.

Thanks.

this does not seem to be the type of operation suitable for a trigger

how often did you want to perform this operation?

Running a day… I think that it is possible… I wrong… sorry :confused: