Solved

delete where the length of varchar < 10

Posted on 2008-10-12
1
279 Views
Last Modified: 2012-08-14
hi
i have one table  (int id , varchar(20) name)

how can i delete a record from database where length of name < 10
 i mean i want to delete it where it's less than 10 characters
thanks
0
Comment
Question by:klay8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
furrybootsistheanswer earned 500 total points
ID: 22699611
You can use this to determine the length of the name;
len([name])

if you have trailing spaces, you may want to trim the field;
len(rtrim([name]))

So your statement to delete would be;

delete from <tablename> where len([name]) < 10

or

delete from <tablename> where len(rtrim([name])) < 10

You should run this as a select first to make sure you get the expected rows;
select * from <tablename> where len([name]) < 10
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mysql ide 10 48
Sudden decrease in performance when updating mysql using classic asp 6 34
What is this datetime? 1 29
Better way to filter date  - Query 5 24
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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