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 |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2009-03-25 : 04:14:35
|
| Does anyone know how one can enter the word NOt at the beginning of contains? i.e.select...where...and contains(fieldName, 'NOT "company" OR "society" OR "general" OR NOT "addresses"')The above should return records as follows:All records that contain: "society" OR "general"Exclude records that contain: "company" or "addresses"Thanks |
|
|
chrianth
Yak Posting Veteran
50 Posts |
Posted - 2009-03-25 : 05:06:21
|
quote: Originally posted by arkiboys Does anyone know how one can enter the word NOt at the beginning of contains? i.e.select...where...and contains(fieldName, 'NOT "company" OR "society" OR "general" OR NOT "addresses"')The above should return records as follows:All records that contain: "society" OR "general"Exclude records that contain: "company" or "addresses"Thanks
i think IN will work fine based on your requirement like...where fieldName in ('society','general') |
 |
|
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2009-03-25 : 05:14:35
|
quote: Originally posted by chrianth
quote: Originally posted by arkiboys Does anyone know how one can enter the word NOt at the beginning of contains? i.e.select...where...and contains(fieldName, 'NOT "company" OR "society" OR "general" OR NOT "addresses"')The above should return records as follows:All records that contain: "society" OR "general"Exclude records that contain: "company" or "addresses"Thanks
i think IN will work fine based on your requirement like...where fieldName in ('society','general')
Please note that I would like to use contains as mentioned before. Any thoughts on that please?Thanks |
 |
|
|
chrianth
Yak Posting Veteran
50 Posts |
Posted - 2009-03-25 : 05:50:19
|
quote: Originally posted by arkiboys
quote: Originally posted by chrianth
quote: Originally posted by arkiboys Does anyone know how one can enter the word NOt at the beginning of contains? i.e.select...where...and contains(fieldName, 'NOT "company" OR "society" OR "general" OR NOT "addresses"')The above should return records as follows:All records that contain: "society" OR "general"Exclude records that contain: "company" or "addresses"Thanks
i think IN will work fine based on your requirement like...where fieldName in ('society','general')
Please note that I would like to use contains as mentioned before. Any thoughts on that please?Thanks
Hmmmnn, I can't seem to find a way to let the CONTAINS command work in SQL Server 2005. I haven't tried using it before, I can only think IN and LIKE commands as the best alternative to use based on what you are trying to show/have. |
 |
|
|
|
|
|