Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Field value = one word

Author  Topic 

lemondash
Posting Yak Master

159 Posts

Posted - 2012-05-18 : 06:24:42
Hello All,

I try to write a query on a field that will return where that field ony has one word.

Thanks Lee

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2012-05-18 : 06:40:03
You can use LEN(Yourcolumn)=1

------------------------------------------------
The answer is always no till than you don't ask.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2012-05-18 : 08:40:11
quote:
Originally posted by ashishashish

You can use LEN(Yourcolumn)=1

------------------------------------------------
The answer is always no till than you don't ask.


This will work for a word with only one letter. For one word with mulitple characters

WHERE len(col)-len(replace(ltrim(rtrim(col)),' ',''))=0

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -