Solved

sql delete question

Posted on 2006-07-15
5
160 Views
Last Modified: 2010-05-18
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
Comment
Question by:thenone
  • 3
  • 2
5 Comments
 
LVL 95

Expert Comment

by:Lee W, MVP
Comment Utility
DELETE FROM Table WHERE Column IS NULL
0
 
LVL 8

Author Comment

by:thenone
Comment Utility
and what if it is "" or contains a . that I want to delete same thing?
0
 
LVL 95

Expert Comment

by:Lee W, MVP
Comment Utility
Add some ORs.

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

0
 
LVL 95

Accepted Solution

by:
Lee W, MVP earned 500 total points
Comment Utility
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
 
LVL 8

Author Comment

by:thenone
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now