• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

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?
0
thenone
Asked:
thenone
  • 3
  • 2
1 Solution
 
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
 
Lee W, MVPTechnology 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
 
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now