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)
 search multiple columns

Author  Topic 

magmo
Aged Yak Warrior

558 Posts

Posted - 2014-09-09 : 14:04:33
Hi

I need to search 30 columns for a search value based on LIKE '%stringtofind%'. I know I can use the search criteria like this...

WHERE Column1 LIKE '%stringtofind%' OR Column2 LIKE '%stringtofind%' OR and so on, but is there a more elegant way?

viggneshwar
Yak Posting Veteran

86 Posts

Posted - 2015-01-09 : 00:43:51
https://gallery.technet.microsoft.com/scriptcenter/c0c57332-8624-48c0-b4c3-5b31fe641c58

http://solutioncenter.apexsql.com/quickly-search-for-sql-database-data-and-objects/

Regards
Viggneshwar A
Go to Top of Page

magmo
Aged Yak Warrior

558 Posts

Posted - 2015-01-09 : 05:34:34
Thanks, excellent reply!
Go to Top of Page
   

- Advertisement -