in reply to insert into mssql table

Perhaps param() isn't returning a true value. You can either print out the parameters before you reach the conditional to see whether they contain what you expect, or replace the conditional with  if (1) for debugging purposes.

/J\