Sql query for updating database if value is not null?

Without knowing your database it’s tough to be specific. In SQL Server the syntax would be something like …

UPDATE MyTable 
SET 
        Field1 = IsNull(@Field1, Field1),
        Field2 = IsNull(@Field2, Field2),
        Field3 = IsNull(@Field3, Field3)
WHERE 
     <your criteria here>

EDIT

Since you specified SQLLite …replace my IsNull function with COALESCE() or alternately look at the IfNull function.

Leave a Comment

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