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 2000 Forums
 SQL Server Development (2000)
 SQL LIKE Function

Author  Topic 

oahu9872
Posting Yak Master

112 Posts

Posted - 2006-11-03 : 19:39:31
I'm trying to write a query that will search for a specific character string within a field. Is this possible? Here is what I tried. If you see anything wrong or know of a better way, let me know.

SELECT * FROM MYTABLE
WHERE MYCOLUMN LIKE 'ABCDEF'

Thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-11-03 : 19:47:39
You need to use %

SELECT * FROM MYTABLE
WHERE MYCOLUMN LIKE 'ABCDEF%'

SELECT * FROM MYTABLE
WHERE MYCOLUMN LIKE '%ABCDEF%'

SELECT * FROM MYTABLE
WHERE MYCOLUMN LIKE '%ABCDEF'

It depends on what you are searching for

Madhivanan

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

oahu9872
Posting Yak Master

112 Posts

Posted - 2006-11-03 : 19:50:03
I can't believe i missed that. thanks for the help
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-11-03 : 19:56:02
quote:
Originally posted by oahu9872

I can't believe i missed that. thanks for the help


It happens sometimes

Madhivanan

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

- Advertisement -