issue on inserting null values in dynamic sql

  • First of all, why are you writing a dynamic procedure for this?

    The standard INSERT statement allows for nulls anyway, so the procedure could just be a single line:-

    INSERT AccountAO_Receive (AccountAO_Fund_id, transaction_type, .....

    VALUES (@FundId, @TransType,....

    To answer your question about the problem with your stored procedure, your are inconsistent in the way you are putting quotes around the parameter values e.g. you aren't supplying an opening quote for @FundId. But on the same line, you are supplying the opening quote for the following parameter. If the following parameter is @Transtype, you are supplying yet another opening quote.

    Supplying an opening quote for the next parameter will also cause a problem where the rest of the parameters are null... you will have already supplied opening quotes for a non existent parameter.

Viewing post 1 (of 2 total)

You must be logged in to reply to this topic. Login to reply