Reputation: 169
Based in a table with follow structure:
column1 column2 column3 ... columnN
1 null null null null
How i can delete all the row in the table that contain all null values? (except the 1st column that is an ID column)
Thank you guys
Upvotes: 0
Views: 32
Reputation: 19
Delete from tbl1 where ISNULL(column1,'')=''
and ISNULL(column2,'')='' and ISNULL(column3,'')=''
Upvotes: 0
Reputation: 11154
Please try with below code snippet.
DELETE FROM TableName
WHERE COALESCE (column2,column3,column4) IS NULL;
Upvotes: 1