Checking isnull for two fields

puthenveetil

Registered User.
Local time
Tomorrow, 03:57
Joined
Aug 9, 2004
Messages
94
Hi all,

I had a little problem with delete query. I would like to delete the records by checking two fields if both fields are empty. I mean if a records had both these fields are empty only. If one of the field has data , the record should stay there.. Is there any way I can do this?


Thanks in advance.


Thanks
 
DELETE *
FROM [TableName]
WHERE [Field1] is null and [Field2] is null;
.
 
Hi Jon

Thanks for the reply


DELETE *
FROM Details
WHERE [No_cover] is null and [Load_amt] is null;

This is my query, in this it should delete all the records which [No_cover] and [Load_amt] is null. If any one this field has data it should stay there. Will this code do that???


thanks in advance



Thanks
 
Yes it will delete those records where both fields are null.

To preview which records will be deleted, you can change Delete to Select:-

SELECT *
FROM Details
WHERE [No_cover] is null and [Load_amt] is null;


You can back up your table before running a delete query for the first time.
.
 

Users who are viewing this thread

Back
Top Bottom