Remove rows where specific field contains string value

  • Thread starter Thread starter Ahmad
  • Start date Start date
A

Ahmad

Hi,

I have to remove rows from a table where a specific Field say "F1"
contains string value instead of Numeric value. Suppose we have a
table myTable having following values.

F1 F2 F3
---- ----- ------
12 A B
10 C D
AB E F
XZ G H

Now the Query I want to write is somewhat like this.

DELETE * FROM myTable where (F1 contains string values instead of
numeric).

NOTE: Data Type of field F1 is TEXT.

The output after executing the query must be:

F1 F2 F3
---- ----- ------
12 A B
10 C D

Thanks in anticipation.

Regards,

Ahmad Jalil Qarshi
 
Ahmad:

The IsNumeric function returns a value of True if a text string is a valid
number, so you can use Not IsNumeric to find those which are not numbers, e.g.

DELETE *
FROM [MyTable]
WHERE Not IsNumeric([F1]);

Before running a query which might delete a large number of rows it’s a very
good idea to back up the table first of course.

Ken Sheridan
Stafford, England
 
Thanks Ken Sheridan,

It resolved my problem.

Bundle of thanks again,

Ahmad Jalil Qarshi

Ahmad:

The IsNumeric function returns a value of True if a text string is a valid
number, so you can use Not IsNumeric to find those which are not numbers, e.g.

DELETE *
FROM [MyTable]
WHERE Not IsNumeric([F1]);

Before running a query which might delete a large number of rows it’s a very
good idea to back up the table first of course.

Ken Sheridan
Stafford, England

Ahmad said:
I have to remove rows from a table where a specific Field say "F1"
contains string value instead of Numeric value. Suppose we have a
table myTable having following values.
F1 F2 F3
---- ----- ------
12 A B
10 C D
AB E F
XZ G H
Now the Query I want to write is somewhat like this.
DELETE * FROM myTable where (F1 contains string values instead of
numeric).
NOTE: Data Type of field F1 is TEXT.
The output after executing the query must be:
F1 F2 F3
---- ----- ------
12 A B
10 C D
Thanks in anticipation.

Ahmad Jalil Qarshi
 
Back
Top