1

I'm using SQL Server 2012. I have indexed the RFC and IMSS column in the Persons table as full text search index. The table is:

PersonId    RFC                              IMSS
---------       ------------                       --------------
1                COGS070990IB3         1247587150
2                COGS070990IB3         4781105741
3                FDRH071580AV2         1200467851
4                QWEZ071245JE1         0913218712

I need to search cascaded RFC and then IMSS using the value of string 'COGS070990IB3 1247587150' and the result should be:

PersonId    RFC                              IMSS
---------       ------------                       --------------
1                COGS070990IB3         1247587150

Is that possible?

I hope you can help me. Thanks!

D. Cortez
  • 11
  • 1

2 Answers2

0

You can use something like ;

SELECT PersonId, RFC, IMSS FROM dbo.Persons 
WHERE CONTAINS((RFC), 'COGS070990IB3')
AND CONTAINS((IMSS), '1247587150');

Source: FullText search with CONTAINS on multiple columns and predicate - AND

mehmet sahin
  • 802
  • 7
  • 21
  • Thanks for the answer, but I need a query that not separate the string. Something like: SELECT PersonId, RFC, IMSS FROM dbo.Persons WHERE CONTAINS((RFC, IMSS), 'COGS070990IB3 1247587150'); – D. Cortez Aug 10 '17 at 14:30
0

Try This:

SELECT * FROM Persons AS per WHERE FREETEXT(per.*, 'COGS070990IB3 1247587150')