vendredi 20 mars 2020

If else in sql with multiple insert statements

select din,driv_height,city,Driver_Addres_Posta_Code,DRIV_GENDER_ID from driv_testing if DRIV_GENDER_ID IN('M','F') begin insert into driv_success end else DRIV_GENDER_ID not in ('M','F') begin insert into error_logs(error_description) values('Gender fails') end

i have one source table driv_testing and sink table driv_success and error_logs table to log bad records.

if DRIV_GENDER_ID IN('M','F') then i want to insert into driv_success otherwise insert into error_logs table..

but i am getting error for the above query ..pls help me in finding a solution for this

Aucun commentaire:

Enregistrer un commentaire