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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 NOT LIKE "FO"

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2010-11-24 : 10:39:46
Is there a wildcard syntax that will search for strings that don't contain the two-letter sequence "FO"?

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2010-11-24 : 10:42:55
where col not like '%FO%'

You can also do
like '%[^A-Z]%'
that will return everything with at least one character not between A and Z - i.e not a capital letter.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-11-24 : 10:44:37
you can also use

PATINDEX('%FO%',col) = 0

if col doesnt contain index

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-11-24 : 11:44:28
WHERE Col = REPLACE(Col,'FO','')

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-11-24 : 11:45:06
in any case, they will all be a scan

I think



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2010-11-29 : 09:41:35
Argh! The SQL is fixed as:

WHERE Column LIKE Parameter

where Parameter can be specified by the end user as any of the allowed LIKE arguments.

This will need development to support NOT LIKE Parameter...

Sam
Go to Top of Page
   

- Advertisement -