Reputation: 927
I have been trying to get the rows where cell is empty but how can i get an empty cell Its not NULL over there, its like an empty string.
05J9LJ-E E004030 BGH/F.TB
E004032 000080.KS
002X87-E E004033 018880.KS
So second row, first column is like 8 spaces so how can i get these rows
SELECT column_A,column_B,column_C FROM [dbo].[table] where column_A is null
SELECT column_A,column_B,column_C FROM [dbo].[table] where column_A = ''
When i put the data in notepad++
Upvotes: 0
Views: 1106
Reputation: 460098
You can check if they are NULL
or spaces by using an OR
between both conditions:
WHERE column_A IS NULL
OR column_A = '' -- includes multiple spaces
Upvotes: 1
Reputation: 1269693
You can check that there are no non-space characters in the value:
SELECT column_A, column_B, column_C
FROM [dbo].[table]
WHERE column_A is null OR
column_A NOT LIKE '%[^ ]%'
This has the advantage that you can include other characters besides spaces, if you need to.
Upvotes: 1