Is there something wrong with my query or my full text catalog? The first query returns data while the second one does not. Does it have something to do with it being a number? I can get the rows to return by searching on alpha text.
select * from gk_info
where info_desc like '%6416%'
select * from gk_info WHERE
CONTAINS (info_desc, '"6416"')
I have a problem with sql 7 full text query. Everything appears to be in place the database is enabled and the catalogue populated but a query like this select * from risks_intercat WHERE CONTAINS(RISK_NOTES, ' "bean curd" ') always returns this; Search on full-text catalog 'ftc_Risks_ic' for database ID 8, table ID 329768232 with search condition ' "bean curd" ' failed with unknown result (8bcf8cc). has anybody got any ideas why?
My host does allow me to create full text catalogs. I use SQL Server Management Studio Express, so I'd have to do it "by hand" as opposed to point-clicking menus and going through wizards. Where do I go to find those commands? I've seen them before but I can't remember where to get them. They're the ones that begin with sp_. I need the commands for:
Hello!! I want to add the full text search feature into 2 columns of a table in my DB.What will be the query that I should execute.I have aalready the tables existing.So probably I need to ALTER alongwith the new functions!!
Hope you can ignore your personal music tastes with this post!I have a table of Artists with a Full Text Index on a few columns on that table. My full text querying against this table works really well apart from it seems for one band - "Take That"! I'm guessing this is because these words consitute noise words? I parse user's search terms and add an "AND" between each word. So for example my query is essentially:select * from containstable(Artists, *, '"take AND that"') As I say, this works fine for Pink Floyd etc, but not for these guys! So either SQL Server has a preference on boy bands or I am thinking it is because these words are deemed to be noise. Anybody got any tips on how I could tackle this? I suppose it is quite possible that there might be another band with the same problem.I do have exclusive access to the SQL box, so perhaps I could edit the noise words file......Thanks
Hi - I am trying to add paging to my stored procedure. The stored procedure successfully executes a full-text search. Unfortunately, the paging routine below the full-text search operates on the articles table after the search has been conducted. This means that it utilizes the row numbers from the entire table rather than the row numbers from the result set. I somehow need to the paging routine starting at "WITH tempArticles AS" to operate on the search results rather than the articles table. I am too new to SQL and can't figure out how to populate a temporary table storing text search results to use in this paging routine. Can anyone help me with this? Thanks! Peter dbo.Search_Articles @searchText varchar(150), @PageSize int, @PageNumber int AS Declare @RowStart int Declare @RowEnd int if @PageNumber > 0 Begin SET @PageNumber = @PageNumber -1; SET @RowStart = @PageSize * @PageNumber + 1; SET @RowEnd = @RowStart + @PageSize - 1 ; CREATE TABLE #results (ArticleID int) INSERT INTO #results SELECT ArticleID FROM articles WHERE CONTAINS(Description, @searchText) OR CONTAINS(Title, @searchText) UNION SELECT ArticleID FROM article_pages WHERE CONTAINS(Text, @searchText) /*this returns all matching records from the text search*/ SELECT * FROM articles, #results WHERE #results.ArticleID=articles.ArticleID; WITH tempArticles AS ( SELECT Title, PostDate, UserID, City, Country, Tags, StoryID, Approved, ROW_NUMBER() OVER (order by PostDate) as RowNumber FROM articles WHERE Approved = 1) SELECT * FROM tempArticles WHERE RowNumber >= @RowStart and RowNumber <= @RowEnd; END
I've created a FullTextCatalog on one of my Databases and added a full text index on one of my text columns.
The first time I run a query against the data it takes roughly 40-45 seconds to return data. After that it blazes and runs in under a second. If I don't query it for 20-30 minutes, it will take 40-45 seconds again and then fly until the next break.
Is there a configuration setting somewhere that I'm missing on this? Currently the Index is only about 5MB so it should take that long to read in when I'm querying it.
I don't think it has anything to do with size because the actual return can contain anywhere from 10-80K rows and the speed is about the same.
I'm using Standard edition on a 2003 Standard Server if that plays into the potential problem at all. We're currently downloading and installing the new Service Pack to see if that fixes it, but for some reason I'm not holding my breath. I'm assuming that there is something we need to change in the configuration.
Let me know if I'm missing any pertinent information. Thanks.
For one day, this SPROC executes very quickly to return results on a Full Text catalog.
Code Snippet ALTER Procedure dbo.sp_RSSHarvestedHeadlines_FullTextSearch ( @ORKeywords varchar(4000) = 'xxxx', @ANDKeywords varchar(4000) = 'xxxx', @NOTKeywords varchar(4000) = 'xxxx', @SourceID int = -1, @IsHidden bit = null ) As set nocount on SELECT HHL.HeadlineID, HHL.Title, HHL.Link, HHL.[Description], HHL.PubDate, HHL.GMTDateAdded, RSSSources.SourceTitle, RSSSources.SourceLink FROM RSSHarvestedHeadlines HHL INNER JOIN RSSSources ON HHL.SourceID = RSSSources.SourceID WHERE HHL.PublishedFlag = 0 AND (@IsHidden is null OR HHL.HideFlag = @IsHidden) AND (@SourceID = -1 OR HHL.SourceID = @SourceID) AND (@ORKeywords = 'xxxx' OR (CONTAINS(HHL.Title, @ORKeywords) OR CONTAINS(HHL.Description, @ORKeywords))) AND (@ANDKeywords = 'xxxx' OR (CONTAINS(HHL.Title, @ANDKeywords) OR CONTAINS(HHL.Description, @ANDKeywords))) AND ( @NOTKeywords = 'xxxx' OR ( (NOT CONTAINS(HHL.Title, @NOTKeywords) AND NOT CONTAINS(HHL.Description, @NOTKeywords)) ) ) ORDER BY HHL.GMTDateAdded DESC, HHL.PubDate DESC
But somethign happens overnight and in the morning the sproc times out. While running (even from a new query window on the SQL 2005 server itself) it utilizes 100% CPU until it times out.
When I pass default parameters to the sproc (not using any part of the query that uses Full Text) the sproc returns every record in the database very quickly. No hang ups.
But the moment I add any text in say the @ORKeywords parameter, for example, the sproc utilizes 100% CPU for maybe 15 seconds and then times out.
By accident I discovered that I can fix this temporarily by copying the database. I don't use the new copy or anything. Just the act of copying the database fixes it. The sproc then executes normally, and quickly. But the next morning it's back to slow again.
Note, over night I am adding about 1000 records to the table.
Would automatic updates to the FT Catalog choke on 1000 records?
Also note that one of the fields being cataloged is a "Text" field (blob). Would that cause this?
Would what text is being added to the table matter? What if an invalid character was added (like some european character or a control character)? Would FT indexing hang up on that?
The first time I run it in the SQL query analyzer it sits there for about 30 seconds and then gives me "Timeout expired (error - 2147217871)." After the first query attempt I can run it as many times as I want and it will work fine (no errors) ... But if I wait for about 30 minutes and then try it again, it will give the error again just on the first try. I've tried using search words that exist and ones that don't exist in the db and they both give the same error, so it's not that it's trying to return too many rows.
I'm using Microsoft SQL Server 2005. The code I'm writing is pretty basic so maybe it's the way that the database is set up or the way I initiated the full text tables? Any help would be greatly appreciated. Thank you.
I have a table with 3M rows that contains a varchar(2000) field withvarious keywords. Here is the table structure:PKColumnImageIDFullTextColumnThere is an association table:ImageIDContractIDNow, I want to do a query where the ContractID = x and Contains someword in the FullTextColumn. There is an association table that mapsImages to Contracts - so I can't use the trick of putting the Contractcode in the FullTextColumn.I'm finding that first the FTS service is performing a search on theKeyword (which can take a long time if 100K rows are returned) thenjoining to the association table for the particular contract.Is there anyway to make this faster by telling the FTS service, onlysearch this subset of rows for the keyword based on the contract.Sorry if this sounds convoluted. Appreciate any help you can suggest.Thanks!
I'm running into a problem with Full-Text searching. I have a procedure which uses a full-text search. When I run it in SQL query analyzer €“ it runs immediately. I exec this procedure from my ASP page and it returns timeout error. After the first query attempt I can run it (executing the ASP-page) as many times as I want with different search words and it will work fine (no errors) ... But if I wait for about 30 minutes and then try it again, it will give the error again just on the first try. I've tried using search words that exist and ones that don't exist in the db and they both give the same error, so it's not that it's trying to return too many rows.
I'm using Microsoft SQL Server 2005. Any help would be greatly appreciated. Thank you.
I am getting a really weird error message when executing a full-text query on SQL server 2005:
------------------------- Microsoft OLE DB Provider for SQL Server error '80040e14' The execution of a full-text query failed. "The form specified for the subject is not one supported or known by the specified trust provider." -------------------------
Just to give a bit of background: we recently moved our database from a machine with SQL Server 2003 to a different computer with SQL Server 2005. This is when the error started showing up.
The query is not particular complex:
SELECT * FROM myTable M INNER JOIN FREETEXTTABLE(myTable, *, 'keyword') ct ON ct.[KEY] = M.Resource_ID
It's the "Freetexttable" bit that creates the error message. I have done some research on google, but I can't seem to find a solution.
Has anybody come across this error before? Any ideas on how I could fix it?
We have a query that uses the Full-text index on a view that's returning duplicate rows. We thought maybe it was the way we were joining, but we were able to simplify the query as much as possible and it still happens. Here's the query:
Code Snippet SELECT * FROM FREETEXTTABLE(vwSubtable, TitleSearch, 'Across five Aprils') AS KEY_TBL ORDER BY RANK DESC
vwSubtable is an indexed view that contains some of the columns in our original table, and is also filtering out some rows from the main table in a where clause. There are no joins in the view.
This seems like it's about as simple a query as we could get. It will return some rows twice (ie. the same primary key row is returned back as two separate rows in the resultset). This is a problem since we're filling a datagrid, which is throwing a ConcurrencyException because the primary key is already in there.
I made sure we have SP2 installed on my SQL Server. Any ideas on what might be happening?
I am getting following error when query using a full-text index:
select * from workitemlongtexts where Contains(words, 'test');
==error message== Msg 7619, Level 16, State 1, Line 1 The execution of a full-text query failed. "Service is not running."
I have verified that 1. msftesql service is running, 2. I even rebuilt the full-text index and it didn't help 3. my full-text crawl job is running fine 4. my DB is full-text enabled
Can someone explain what "Service" the error refers to? I am using SQL 2005 Ent SP1.
when i execute a query for the first time whith full text service from visual studio, show me the error 'server not responding' and when i execute this query for second time works perfectly.
I have written this sample query to search a full-text indexed table and return the results. If the word occurs more than once I want it to return as a new record and the results show a short summary of the location. I was using 'like', but the full table scans were really slowing it down. Can performance be improved for the following (The results returned by my query are accurate)
Hi, i'm trying to do a full text search on my site to add a weighting score to my results. I have the following database structure: Documents: - DocumentID (int, PK) - Title (varchar) - Content (text) - CategoryID (int, FK) Categories: - CategoryID (int, PK) - CategoryName (varchar) I need to create a full text index which searches the Title, Content and CategoryName fields. I figured since i needed to search the CategoryName field i would create an indexed view. I tried to execute the following query: CREATE VIEW vw_DocumentsWITH SCHEMABINDING ASSELECT dbo.Documents.DocumentID, dbo.Documents.Title, dbo.Documents.[Content], dbo.Documents.CategoryID, dbo.Categories.CategoryNameFROM dbo.Categories INNER JOIN dbo.Documents ON dbo.Categories.CategoryID = dbo.Documents.CategoryID GOCREATE UNIQUE CLUSTERED INDEX vw_DocumentsIndexON vw_Documents(DocumentID) But this gave me the error: Cannot create index on view 'dbname.dbo.vw_Documents'. It contains text, ntext, image or xml columns. I tried converting the Content to a varchar(max) within my view but it still didn't like. Appreciate if someone can tell me how this can be done as surely what i'm trying to do is not ground breaking.
Hello everyone ! I want to perform Full Text Search with SQL Server 2000. My documents (.doc, .xls, .txt, .pdf) are stored in a SQL Server field which is binary (the type of the column is image). I would like to know, how you can extract pieces of text from the documents. Example: I have a ASPX page with codebehind in C# making the search in a table in SQL server that is full text indexed. I make a search looking for the word "peace", than SQL server will take care about the search and return it to me the rows that match with that. But also I'd like to extract the 50 characters before and after where sql server found the word "peace" to show in the result page. Does anyone has any idea how to work around it ? Best regards. Yannick
Hi - I'm short of SQL experience and hacking my way through creating a simple search feature for a personal project. I would be very grateful if anyone could help me out with writing a stored procedure. Problem: I have two tables with three columns indexed for full-text search. So far I have been able to successfully execute the following query returning matching row ids: dbo.Search_Articles @searchText varchar(150) AS SELECT ArticleID FROM articles WHERE CONTAINS(Description, @searchText) OR CONTAINS(Title, @searchText) UNION SELECT ArticleID FROM article_pages WHERE CONTAINS(Text, @searchText); RETURN This returns the ArticleID for any articles or article_pages records where there is a text match. I ultimately need the stored procedure to return all columns from the articles table for matches and not just the StoryID. Seems like maybe I should try using some kind of JOIN on the result of the UNION above and the articles table? But I have so far been unable to figure out how to do this as I can't seem to declare a name for the result table of the UNION above. Perhaps there is another more eloquent solution? Thanks! Peter
I have a column in a table that has a type TEXT,when I pull the length of a row it returns 88222 but when I select from that column it dows not show all the text in the result set.
I am using the following plumbing code to search a database column for a keyword. I can't use full-test indexing so I came up w/ this work around. But It has many flaws so I'm looking for a better way. Thx in advance.
'Open sql connection SqlConnection1.Open()
Dim datareader2 As SqlClient.SqlDataReader datareader2 = cmdFindRowsWithKeyword.ExecuteReader Dim strMsg As String Dim intRowToFlag As Integer Dim strRowsToGet As String Dim strKeywordAsTyped As String Dim strKeywordAllCaps As String Dim strKeywordAllLower As String Dim strKeywordFirstLetterCap As String Dim FirstLetter As String
'Assign keyword as typed to variable strKeywordAsTyped = txtSearchFor.Text 'Assign keyword as typed to variable then convert it to all uppercase strKeywordAllCaps = txtSearchFor.Text strKeywordAllCaps = strKeywordAllCaps.ToUpper 'Assign keyword as typed to variable then convert it to all lowercase strKeywordAllLower = txtSearchFor.Text strKeywordAllLower = strKeywordAllLower.ToLower 'Assign keyword as typed to variable then convert it so just the first letter is in uppercase strKeywordFirstLetterCap = txtSearchFor.Text FirstLetter = strKeywordFirstLetterCap.Chars(0) FirstLetter = FirstLetter.ToUpper strKeywordFirstLetterCap = strKeywordFirstLetterCap.Remove(0, 1) strKeywordFirstLetterCap = strKeywordFirstLetterCap.Insert(0, FirstLetter)
'If the string contains the keyword as typed in all caps all lowercase or w/ the 1st letter in caps then flag that row. If strMsg.IndexOf(strKeywordAsTyped) <> -1 Or strMsg.IndexOf(strKeywordAllCaps) <> -1 Or strMsg.IndexOf(strKeywordAllLower) <> -1 Or strMsg.IndexOf(strKeywordFirstLetterCap) <> -1 Then
cmdFlagRowsWithKeyword.Parameters("@recid").Value = intRowToFlag SqlConnection2.Open() Dim datareader3 As SqlClient.SqlDataReader datareader3 = cmdFlagRowsWithKeyword.ExecuteReader datareader3.Close() SqlConnection2.Close()
Can you not add a text column to a full text index?? If I change it to a nvarchar it works fine but if I change it to a text column it wont index. Anyone know how to fix this?
I have a text column which my users use extensively for like queries. The table has 1.3 Millon rows and has seen som eperformance issue ie it does a table scan and blocks other processes.
I was wondering if anyone how to handle this coulmn can I create indexes or better can text column support full text indexing.
Anyone who can shed any ideas as what might be the best possible solution will be great
i am tring to create the full text catalog I am following the direction at http://technet.microsoft.com/en-us/library/ms189520.aspx but on the last command it gives me an error
'PK_problem' is not a valid index to enforce a full-text search key. A full-text search key must be a unique, non-nullable, single-column index which is not offline, is not defined on a non-deterministic or imprecise nonpersisted computed column, and has maximum size of 900 bytes. Choose another index for the full-text key.
also I tried the wizard in the managment express but it does not have a option when I right click on the table for Full-Text Index
I created a new catalog and a new index but when I start a search the grid come back empty I didnt insert any data into the table until after I created the catalog and index I dont think it has indexed the data yet. How do I force this or make it???? I have another example where I inserted data and then created the catalog and index and did a search and the proper rows came back but then I inserted new data and searched on a keyword that should have brought it up but nothing showed?
Hi, I have a SQL statement that works great when I don't use a SQL Parameter, but when I do it just takes the @Searchfor as literal text "@SearchFor" instead of the string @SearchFor represents. Any ideas? Below is the two versions of the sql statements sqlComm.Parameters.Add(new SqlParameter("@SearchFor", strSearchFor)); sqlComm.CommandText = "SELECT RANK, intID, chTitle, chDescription " "FROM FREETEXTTABLE( tblItems, *, 'ISABOUT("+ strSearchFor +" WEIGHT(1.0))') a " + "JOIN tblItems b on a.[KEY] = b.intID ORDER BY RANK DESC; ";
sqlComm.Parameters.Add(new SqlParameter("@SearchFor", strSearchFor)); sqlComm.CommandText = "SELECT RANK, intID, chTitle, chDescription " + "FROM FREETEXTTABLE( tblItems, *, 'ISABOUT(@SearchFor WEIGHT(1.0))') a " + "JOIN tblItems b on a.[KEY] = b.intID ORDER BY RANK DESC; ";
I have a Full-text search that is being performed on a variable (@Description) see part of querie below: WHERE (CONTAINS([Description], @Description) This search only seems to work when a text fo 3 or greater characters is used Ball, but not for "an" or "a". it also does not search on part of a word i.e. "Gard" of "Garden" Two things: 1) How do I perform the CONTAINS search for part of a word or "a". 2) How do I perform a search that returns all values, when I leave the input feild blank it returns no records. Many thanks in advance
Hi I have a full text index on my product table. When I do a search for Record, it returns all values for Record and Records.Now If I do a search with a spelling mistake say Recod . it doen't return anything.How can I get the full text to return my query even if there is a spelling mistake ? Thanks My query:SELECT * From Product WHERE FREETEXT (description, @SearchString)
I have implemented Full text search in my web application. I am using sql server 2005 database. I used “contains “Keyword for full text search. These are syntax as given below: CONTAINS ( { column | * } , '< contains_search_condition >' ) < contains_search_condition > ::= { < simple_term > | < prefix_term > | < generation_term > | < proximity_term > | < weighted_term > } | { ( < contains_search_condition > ) { AND | AND NOT | OR } < contains_search_condition > [ ...n ] } My search gives correct results according to AND NOT and OR. But, it is not working if I used AND. Please give me solution. Its very urgent for me……
full text indexing Hi, In SQL Server 2005, if I set full text indexing enables in column MyDesc and 1. use “Select * from MyTable where MyDesc LIKE ‘%abc%’� would this be using full text indexing? Or have to use Contains to get it be in use? 2. Once I create the full-text index, should I be setting it to populate periodically? Isn’t it populating itself?