[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

SQL Querys Starts with letter only

Posted on 2012-09-06
3
Medium Priority
?
446 Views
Last Modified: 2012-09-27
Hi All

I have a database with over 2 million contacts, i need to remove a names that don't start with a letter we have a few thousand that start with number / symbols which obverly arent really how can build a query to delete these?  

Cheers
0
Comment
Question by:Matb396
  • 2
3 Comments
 
LVL 70

Accepted Solution

by:
Scott Pletcher earned 2000 total points
ID: 38372621
You can do that, but are you SURE the data is really bad?

Plenty of company names start with non-letters ... 1st Tennessee Bank, 3M, etc..


That said, here's the DELETE you asked for:

DELETE FROM dbo.tablename
WHERE
    name LIKE '[^a-zA-z]%' --name doesn't start with a letter
0
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 38372638
delete from mytable where left(mycol, 1) not like '[a-z]'
0
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 38372642
Scott, I'm guessing the question asker is referring to contacts in terms of people.
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.

Question has a verified solution.

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

How to increase the row limit in Jasper Server.
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

872 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