Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count characters in field 1

Status
Not open for further replies.

jvande

MIS
Joined
Jun 6, 2001
Messages
115
Location
US
I would like to be able to run a query that checks for a certian amount of characters in a field. Here is the psuedo code.
select *
from table1
where field1 contains less then 5 characters.

Thanks,
Josh
 

The DATALENGTH function counts all characters in the column.

select *
from table1
where datalength(field1)>=5

The LEN function will not count the trailing spaces.

select *
from table1
where len(field1)>=5 Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top