sql delete question

this connn.execute"delete from table where column = ' ' "
or connn.execute "delete from table where column = null"


both of these are not deleting?
I checked the table and that column is null?
LVL 8
thenoneAsked:
Who is Participating?
 
Lee W, MVPConnect With a Mentor Technology and Business Process AdvisorCommented:
Frankly, I don't delete data from my tables.  I use tables that relate to each other on IDs and if I were to delete a row, I could end up messing up my database.  Instead, I create a field of bit type called "Del" - then I set Del = 0 for not deleted and Del = 1 for deleted.  Then in my criteria searches I just throw in to the WHERE clause ... AND Del = 0.  No accidental PERMANENT deletions this way.
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
DELETE FROM Table WHERE Column IS NULL
0
 
thenoneAuthor Commented:
and what if it is "" or contains a . that I want to delete same thing?
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Add some ORs.

DELETE FROM Table WHERE Column IS NULL OR Column = '' OR Column = '.'

0
 
thenoneAuthor Commented:
oh ok so if the column is blank then = ' ' would work thanks its only when its null do you need to do is null.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.