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
 General SQL Server Forums
 New to SQL Server Programming
 Finding Col Values

Author  Topic 

sspr
Starting Member

7 Posts

Posted - 2006-03-22 : 05:11:32
Hi
I am new to SQL. My scenario is I get a string from the user I need to match this string with value present in 2 cloumns. If the string is present in either of the column then i should select that particular record from the table.
Now my question is if i Have to match with one cloumn i can used charindex function is there any function with which i can match the string with data present in more than one cloumn.

Thanks Much

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2006-03-22 : 05:27:50
column1 like '% + @string + %' or column2 like '% + @string + %'
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-22 : 05:56:21
or

column1+column2 like '% + @string + %'

Madhivanan

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

- Advertisement -