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 2012 Forums
 Transact-SQL (2012)
 How to see if something contains a value

Author  Topic 

tshaw20832
Starting Member

10 Posts

Posted - 2014-05-08 : 16:06:04
Example

I want to compare 12345 with abc-12345-1-1111-a and see if the first value is in the second.

Thank you

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-05-08 : 16:09:37
[code]SELECT
CASE WHEN 'abc-12345-1-1111-a' LIKE '%12345%' THEN 'Yes' ELSE 'No' END
[/code]
Go to Top of Page

tshaw20832
Starting Member

10 Posts

Posted - 2014-05-08 : 16:12:04
quote:
Originally posted by James K

SELECT
CASE WHEN 'abc-12345-1-1111-a' LIKE '%12345%' THEN 'Yes' ELSE 'No' END




Thank you very much
Go to Top of Page
   

- Advertisement -