SQL Server stored procedure Nullable parameter

It looks like you’re passing in Null for every argument except for PropertyValueID and DropDownOptionID, right? I don’t think any of your IF statements will fire if only these two values are not-null. In short, I think you have a logic error.

Other than that, I would suggest two things…

First, instead of testing for NULL, use this kind syntax on your if statements (it’s safer)…

    ELSE IF ISNULL(@UnitValue, 0) != 0 AND ISNULL(@UnitOfMeasureID, 0) = 0

Second, add a meaningful PRINT statement before each UPDATE. That way, when you run the sproc in MSSQL, you can look at the messages and see how far it’s actually getting.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)