Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

delete where the length of varchar < 10

Posted on 2008-10-12
1
Medium Priority
?
283 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

610 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