sql - copy content from table into stored procedure for backup and storage -


i've got question raising errors , copying contents table stored procedure.

what need move employee information archive table storage , backup,raise error messages when employee number not exist, , move employee records have no sales, i'm stuck on after i've made sure both sale number , employee number not null. here have far:

        create procedure archiveemployeetranactions          (         @salenumber int,         @employeenumber int         )                 select     sale.employeenumber, employee.firstname, employee.lastname, sale.salenumber                 employee inner join                               sale on employee.employeenumber = sale.employeenumber                              if @salenumber null                              begin                             raiserror ('please enter valid sale number',16,1)                              end                              else                             begin                             if @employeenumber null                             raiserror ('please enter valid employee number',16,1)                             end 

  create procedure archiveemployeetranactions          (            @salenumber int,            @employeenumber int         )     begin         if @salenumber null          begin            raiserror ('please enter valid sale number',16,1)          end

    else if @employeenumber null        raiserror ('please enter valid employee number',16,1)     end      insert archive     select     sale.employeenumber,                 employee.firstname,                 employee.lastname,                 sale.salenumber      employee      inner join sale      on employee.employeenumber = sale.employeenumber     employee.employeenumber=@employeenumber        , sale.salenumber=@salenumber 

end


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -