Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

w2ksp4.exe, WwwxxXdbf, procmail "FROM_MAILER" patch, Use of assignment to $[ is deprecated at /usr/local/sbin/apxs line 86. , wwwxxx vim, mysql closing table and opening table, 800c5000, setgid operation not permitted, pciehp: acpi_pciehprm on IBM, WWWXXX.DBF

Links

XODOX
Impressum

#1: using LEN to find a first word greater than 17

Posted on 2008-04-23 15:02:23 by ciojr

how do i write a sql (ORACLE) statement for where the first word in
the name field is greater than 17 chars?
if i do this

SELECT businessname
FROM tablename
WHERE LEN(businessname) > 17;

it will return all records when the combined length of words is
greater than 17.
i only want to check if the first word is greater than 17

Report this message

#2: Re: using LEN to find a first word greater than 17

Posted on 2008-04-23 15:22:03 by Plamen Ratchev

This is SQL Server newsgroup, so here is how you can do it in SQL Server.
For Oracle you have to check the Oracle newsgroups.

CREATE TABLE Foo (
keycol INT PRIMARY KEY,
businessname VARCHAR(50));

INSERT INTO Foo VALUES(1, 'Tools');
INSERT INTO Foo VALUES(2, 'Someverylongbusinessname Inc.');
INSERT INTO Foo VALUES(3, 'Short Inc.');
INSERT INTO Foo VALUES(4, 'Anotherverylongbusinessname');

SELECT businessname
FROM Foo
WHERE CHARINDEX(' ', businessname + ' ') > 18;

HTH,

Plamen Ratchev
http://www.SQLStudio.com

Report this message