Is this what you are looking for?
IF (Val1 is not null AND Val3 is not null)
BEGIN
insert into TableName (Col1,Col2,Col3) values (Val1,Val2,Val3)
END
At a second glance, BeachBlocker's answer is also very nice. I changed it a bit:
insert into TableName (Col1,Col2,Col3) select Val1,Val2,Val3 where Val1 is not null and Val3 is not null
source
share