Search code examples
sqlt-sqlsql-server-ce

Delete specific records on MSSQL


I'm trying to delete specific records from a table using where clause but unable to do so. The command executes successfully but says zeros rows are modified.enter image description here

enter image description here

I'm still in the starting stage of learning SQL. Thanks for helping out


Solution

  • = NULL never returns true -- almost all comparisons with NULL return NULL, which is treated as false. The correct logic is IS NULL:

    delete from Patient
        where PatientCountry is null