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.
| Author |
Topic |
|
cnbhold
Starting Member
43 Posts |
Posted - 2011-01-06 : 00:13:27
|
| I have a table that contains a field called Keyword. This field should only contain one word. However, users have been typing in more than one word.Incorrect Data EntryID Identity_ID Condition Keyword1 1234 And Microsoft WordCorrect Data EntryID Identity_ID Condition Keyword1 1234 And Microsoft2 1234 And WordThis table contains thousand of records and I need to run a query that shows me all the records that have more that one word in the Keyword field.Select *From KeywordWhere Keyword Like ???Angel |
|
|
cnbhold
Starting Member
43 Posts |
Posted - 2011-01-06 : 00:20:56
|
| I figured it outSelect *From KeywordWhere Keyword Like '% %' |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-01-08 : 01:16:18
|
| this will even return cases where you have some leading or trailing spaces in single word------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-01-08 : 01:17:01
|
may be this?Select *From KeywordWhere LTRIM(RTRIM(Keyword)) Like '% %' ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
cnbhold
Starting Member
43 Posts |
Posted - 2011-01-10 : 10:00:32
|
| Thanks visakh16. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-01-10 : 10:41:07
|
| welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|