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)
 searching for text

Author  Topic 

overbored
Starting Member

12 Posts

Posted - 2002-03-14 : 18:10:46
hi,

i have a table called "agents" that keeps a numbered record of the agents/browsers that my visitors use (2 fields: agt_id and agt_name). i'm now trying to compile statistics based on the gathered info. i have two questions:

1. why does msie identify itself starting with "Mozilla/x.x (compatible; MSIE x.x; ..."?

2. when i try to run "select count(*) from agents where CONTAINS(agt_name, 'MSIE')" to count the number of MSIE users, i get an error 7601 telling me: "Cannot use a CONTAINS or FREETEXT predicate on table 'agents' because it is not full-text indexed." what's going on? how would i distinguish? plz advise, thx! =D

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-03-14 : 18:24:32
The first answer is that the browser agent string is an identifier, and the software vendor can use whatever string they wish, as long as the entire string is unique. I'm not 100% familiar with the browser history (especially Mozilla), but IE was originally based on the Mosaic browser (which was out even before Netscape), and it's very likely it was also based on the Mozilla library. The "MSIE" section is what identifies it as IE.

The second answer is you must set the table to be full-text indexed before you can use CONTAINS, CONTAINSTABLE or FREETEXTTABLE functions. From Enterprise Manager, right-click the table you want to full-text index, and choose the "Full-Text Index Table" option. If this option is not available, you need to ensure Full-text indexing is installed and running on the server. Once that's done, full-text the table, and indicate which column(s) you want to be in the full-text index.

If you cannot set up full-text indexing, you can use the LIKE operator, or CharIndex/PatIndex to search for embedded strings. Books Online has examples of each.

Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2002-03-14 : 18:30:42
1:
Mizilla is kind of a standard for web browsers. I believe it was started by Netscape, but is an open standard. Kinda like saying SQL Server complys with ANSI 92, IE Complies with Mozilla 4.

2:
In order to use CONTAINS, the table/column must be full text indexed. sp_help_fulltext_tables should help you out. Read about full text in BOL.

-Chad

Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2002-03-14 : 18:31:41
Darn,

Snipped again!

Go to Top of Page

overbored
Starting Member

12 Posts

Posted - 2002-03-14 : 19:23:15
ok i got it, as robvolk says, instead of CONTAINS i should've been using LIKE. anyway thanks for the information!

Go to Top of Page

yakoo
Constraint Violating Yak Guru

312 Posts

Posted - 2002-03-14 : 20:10:25
If you have the option to enable full text indexing I think you will be better of using that. Using LIKE on a table that will contain website hits might be quite extensive on the server once this table becomes rather large. Im not sure of the performance gains with using CONTAINS rather than LIKE but from what I understand the Free Text option is definitly faster than the LIKE option.

If you cant use enable the Free Text Search on the server than I guess LIKE is your best bet.

Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-03-15 : 15:17:25
One thing to keep in mind about Full Text Indexes is that, unlike regular indexes, they are not immediately updated when new values are entered in the table. An update to a full text index can be scheduled as a job to run periodically, but just keep in mind the potential delay when dealing with a table that changes frequently.

------------------------
GENERAL-ly speaking...
Go to Top of Page
   

- Advertisement -