Solved

How to exclue numeric data from the select?

Posted on 2011-03-14
7
403 Views
Last Modified: 2012-05-11
There are some errornous data entered in form of 4-digit year.  How can I exclude inserting these?  Thanks.
INSERT INTO [DegreeMajor]
           ([Major Title])
           select distinct ltrim(rtrim(degree_Major)) from dbo.PersonDegree pd
                  where degree_Major is not null and degree_Major not in ('MD', 'Master', 'B.A.', 'M.D.', '.', '', 'Doctor', 'MSC')
0
Comment
Question by:lapucca
7 Comments
 
LVL 13

Accepted Solution

by:
LIONKING earned 300 total points
ID: 35132649
Try ISNUMERIC for SQL:

select distinct ltrim(rtrim(degree_Major)) from dbo.PersonDegree pd
where degree_Major is not null and ISNUMERIC(degree_Major)=1
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 35132670
select distinct ltrim(rtrim(degree_Major))
from dbo.PersonDegree pd
where ISNUMERIC(degree_Major)=1

is enough...
0
 

Author Comment

by:lapucca
ID: 35132691
I don't want numeric value so should it be ISNUMERIC(degree_Major)=0?  Thanks.
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 51

Expert Comment

by:HainKurt
ID: 35132748
!= 1
0
 
LVL 51

Assisted Solution

by:HainKurt
HainKurt earned 200 total points
ID: 35132754
ISNUMERIC(degree_Major)=0

or

ISNUMERIC(degree_Major)!=1
0
 
LVL 4

Expert Comment

by:Alex Matzinger
ID: 35132755
Yes if you are looking for values that are not numeric it should be

ISNUMERIC(degree_Major)=0

or

ISNUMERIC(degree_Major) <> 1
0
 

Author Closing Comment

by:lapucca
ID: 35133777
Thank you.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

895 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

11 Experts available now in Live!

Get 1:1 Help Now