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.
| Author |
Topic |
|
marconi8
Yak Posting Veteran
73 Posts |
Posted - 2003-05-05 : 07:59:50
|
| i'am trying like and contains functions, this two function returns to me results that i need, but which of this function is better to use ? which will be better and with more speed if i this functions i'am using for search text in text |
|
|
dsdeming
479 Posts |
Posted - 2003-05-05 : 08:32:58
|
| Why not test it to find out?DECLARE @i int, @Contains int, @Like int, @Time datetimeSET @i = 0SET @Contains = 0SET @Like = 0WHILE @i < 100BEGIN SET @Time = GETDATE() Perform CONTAINS code here SET @Contains = @Contains + DATEDIFF( ms, @Time, @GETDATE() ) SET @Time = GETDATE() Perform LIKE code here SET @Like = @Like + DATEDIFF( ms, @Time, @GETDATE() )ENDSELECT @Contains, @LikeHTH |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-05-05 : 10:33:52
|
| OK...gotta be the first to admit that I thought you were making up CONTAINS. So I went to the BOL Index, and lo and behold, there it was.I would guess that LIKE is more efficient, only because it has less to do. CONTAINS can do fuzzy and weighted matches. You could use it to do LIKE functionallity as well (in which case I'm guessing thy'd be perform equivalantley (sp?).Is CONTAINS a ANSI Standard? I have no idea.The answer, is as always, "It Depends".Brett8-) |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-05-05 : 11:13:00
|
| contains works on full text indexes and whole words so if you have one it will probably be faster.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|
|
|