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)
 CONTAINS vs. LIKE

Author  Topic 

lmendoza
Starting Member

12 Posts

Posted - 2001-08-20 : 16:08:43
I think I don't quite understand what CONTAINS does, relative to like.

select sku, name from aceb2c_product where contains(description,'duct') and contains(description,'tape')

returns:
sku name
4110847 COUPLER DUCT 4"
4110904 COUPLER DUCT 3"

while
select sku, name from aceb2c_product where description like '%duct%' and description like '%tape%'

returns
sku name
31365 JACK-PHONE SURFC IVORY
3139961 FAN EXHAUST/LITE GLOSS/W
3139979 FAN EXH/LITE POLISH/BR
42908 TAPE DUCT SLVR 2"X60YD
4173308 TAPE DUCT 2"X60YD SILVER
4173324 TAPE DUCT 2"X60YDSSILVER
4110847 COUPLER DUCT 4"
4110904 COUPLER DUCT 3"
4101978 TAPE FOIL 2.5"60YD
40990 TAPE DUCT 2"X10YD SCOTCH
4028460 TAPE METAL RBR1-1/2X10Y
36206 JACK-PHONE SURFC WHITE
1095512 TAPE ROOF SEAM4"X50'SMTH
1095520 TAPE ROOF SEAM 4"X50'RGH
7038318 COUPLE HYD ISO 1/2 MALE
44783 TAPE DUCT 2"X60YD SCOTCH
48216 TAPE DUCT 2"X60YD SCOTCH
29014 RULE OPEN REEL 1/2"X100'
3014271 TAPE ELECT SPLICE 3/4X30

Anyone have any possible solutions to this problem? I know that I can create a temp table, and just keep inserting into that table, but it seems like there should be a more efficient way (i don't want to resort to all those table scans).

TIA
leo

   

- Advertisement -