I need to implement a search procedure for my site that is able to traverse so many tables for results but at the same time making sure not to expose information that is sensitive and I sort of need help to do this as I have not actually done one as big as this one. I need to go through data on Petitions, users, schools and so many other tables in my database to find strings that match the search criteria but I am also conscious that this may cause some security problems with the way I think of it now and i was wondering if any one has a better idea on how to write a search procedure to allow user's to search my site for information.
would you use sql server "full text search" feature as your site index? from some reason i can't make index server my site search catalog, and i wonder if the full text is the solution. i think that i wll have to you create new table called some thing like "site text" and i will need to write every text twice- one the the table (let's say "articles table") and one to the text. other wise- there is problems finding the right urlof the text, searching different tables with different columns name and so on... so i thought create site search table, with the columns: id, text, url and to write every thing to this table. but some how ot look the wrong way, that every forum post, every article, album picture or joke will insert twice to the sqr server... what do you think?
I'm writing a search for our site and I'm running into a few problems.When I run the query like this, it runs just fine:Declare @Keywords varchar(2000)Select @Keywords = 'modern trial advocacy canada'Select product_id, name, count(name) hitsFROM estore_productsINNER JOIN sequenceON estore_products.name like '%' +Substring(' ' + @keywords + ' ',seq,CharIndex(' ' , ' ' + @keywords + ' ' , seq) - seq)+ '%'WHEREseq <= len(' ' + @keywords + ' ') andSubstring(' ' + @keywords + ' ', seq - 1, 1) = ' ' andCharIndex(' ' , ' ' + @keywords + ' ' , seq) - seq 0Group by estore_products.product_id, nameORDER BY Hits DESCBut when I add another column (for example a column called description)from the select statement I get this error:The text, ntext, and image data types cannot be compared or sorted,except when using IS NULL or LIKE operator.Long story short, what do I need to do to select more columns for thefinal output?Thanks,Ryan
I have a MS SQL database that is used with my Web site. I want to enable simple search capability where one or more words could be entered in a text box and have it search certain columns in my database for occurrences of those words. I've never done this before and so I'm not sure how to get started. Can someone help me begin? Thanks!
I am building a generic job site and well I have hit a speed bump. I need to store resumes in the database to be searched on. Well what is the best way to store these full text resumes? so that they can be easily searched on?
Hi, I want to implement site search in my application, I got the solution of searching the static content, but most of the pages in my application is content based(content is coming from database at runtime), so those content I am not able to search from database. While searching about the same, I got information about Full Text search (FT) in SQL Server 2005, but whether it will work in SQL Server 2005 Express or not? I didnt get exact steps to implement FT on my database so far.... Any help?
I have uninstalled and reinstalled several times and I can't get Reporting Services to create the virtual directories in Default Web Site, instead it creates a new web site called Report Server with the virtual directories under that, this Report Server website points to C:Program FilesMicrosoft SQL ServerInetPubwwwroot. Any ideas as to why this happens? My Default Web Site is called Default Website from the initial IIS install , I am on XP Pro SP 2 with IIS 5.1. This is an issue for me since I don't want to have on another site that doesn't have the aspnet mapings.
I am dumbfounded and can't figure out what to do to make it not do that with the default configuration option checked during install. Should I uninstall and reinstall again and not use the default configuration?
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
If you put an index on an integer type column named 'test_column' in a table that had 1,000,000,000 rows in it, and you said select top 50 * from test_table WHERE test_column = 1 since 'test_column' has an index, that would perform extremly fast wouldn't it? Cheers
I'm not sure if this is the appropriate forum to ask this question; however, here goes. I'm being asked to create/modify a search engine for our Web site. Beyond trying to enhance the speed, I've been asked to add spelling and punctuation checks into the search text. Right now, all that's being done is a simple like statement. What's the best method to query a database? For example, if someone typed in "A and W" or "A/Ws" to get the value"A & W's", how would I make the link? Is there a database table that exists that I could reference to replace & with and (or vice versa) , etc... Is there a good place to start?
Hello folks I'm tring to create a search function on a page that searches a database fields. But the problem I am having is that, instead of a user typing in a key word, the have to type in the exact phrase to get a result from the db. For example... With my current code, if a user wants to look for "newbie .net developers in ireland", they would have to type in that exact phrase. But i need to create a function, where the user only has to type in keywords to get a result. For example "developers london" Heres my current codepublic static DataSet Searchgroup (string group_name) { SqlCommand cmd = new SqlCommand("select * from TG_User_Created_Groups where group_name =@group_name", conn);cmd.Parameters.Add(new SqlParameter("@group_name", group_name)); DataSet dst = new DataSet();SqlDataAdapter dtr = new SqlDataAdapter(cmd); dtr.Fill(dst);return dst; }
can anyone offer advise or know of any tutorials around that might demonstrate how I need to do this?
I have an existing Access database that I need to transfer over to a more powerful back-end due to the need for larger size capacity. We need to be able to have a backend that can exist up to just about any size due to us scanning in documents by ODBC. With Access I know I was limited to about 4gb size and when split onto my current SQL server I have heard I will be stuck at 10gb? If so can you recommend a better backend, but my question is about the front end. I hear Windows WPF can be linked into SQL server but does this limit the size as well?
I have problem that Im sure others must have had before so I am looking for advice on the best way to solve it. I have a table of text information tbl_base which is related to another table containing tags, which can contain several rows for each row in base.
I want to create an indexed view of the data for full text search. I would like to select all the tags related to a particular row in the tbl_base together into a string and join it to the end of the tbl_base table so they can be indexed along with the tbl_base data for full text indexing. Ive tried several methods but I am never able to make an index on my view because it say I cant use COALESCE, or Cursors.
Sample data here :
tbl_base
id | Text ------------------------ 1 | BLah blah 2 | Dum de dum 3 | HAr HAr
tbl_base_tags
tagID | base_id | TagText -------------------------- 1 | 1 | first 2 | 1 | second 3 | 1 | third 4 | 2 | fourth
The view I want to end up with will look like this :
vw_tables
base_id | Text | Tags ------------------------------------- 1 | Blah blah | first second third 2 | dum de dum | fourth
How can I achieve this? Do I have to index all the tables seperately?
We have recently upgraded our production server from a dual pentium II 400mhz server with 384Mb of RAM to a triple 700mhz Pentium III system with 2gb of RAM . However, since switching over, all of our Access queries on the SQL7 databases are either running extremely slowly or not at all despite the DSN's being set up correctly . Does anyone have any ideas why, and more importantly, how I can resolve this???
Thanks
Pete Burton (IT Support) Durham Aged Mineworkers Homes Association
Hello, Im not as good as I should be on my sql skills, but Im working on it. Im just wondering if the following SPROC can be cleaned up some or if there might be a better way of doing it? It uses a dropdown with different values (filterby) and a textbox (filter). This is a search feature. ALTER PROCEDURE dbo.AGENTS_SEARCH ( @filterby varchar(15), @filter varchar(25) ) as set nocount on
if (lower(@filterby) = 'city') begin select agent_id, first_name, last_name, middle_name, city, state from agent where city like '%' + ISNULL(@filter,city) + '%' and deleted<>1 and (terminated_dt is null or terminated_dt > getdate()) and status_id <> 26 order by last_name asc end else if(lower(@filterby) = 'name') begin select agent_id, first_name, last_name, middle_name, city, state from agent where (first_name like '%' + ISNULL(@filter,first_name) OR last_name like '%' + ISNULL(@filter,last_name)) and deleted<>1 and (terminated_dt is null or terminated_dt > getdate()) and status_id <> 26 order by last_name asc end else if(lower(@filterby) = 'state') begin select agent_id, first_name, last_name, middle_name, city, state from agent where state like '%' + ISNULL(@filter, state) + '%' and deleted<>1 and (terminated_dt is null or terminated_dt > getdate()) and status_id <> 26 order by last_name asc end else if(lower(@filterby) = 'all') begin select agent_id, first_name, last_name, middle_name, city, state from agent where (first_name like '%' + ISNULL(@filter,first_name) OR last_name like '%' + ISNULL(@filter,last_name)) OR (state like '%' + ISNULL(@filter, state) + '%') OR (city like '%' + ISNULL(@filter,city) + '%') and deleted<>1 and (terminated_dt is null or terminated_dt > getdate()) and status_id <> 26 end else if(@filterby is null and @filter is null) begin select agent_id, first_name, last_name, middle_name, city, state from agent where deleted<>1 and (terminated_dt is null or terminated_dt > getdate()) and status_id <> 26 end Thanks!
Dear friends, I trust that you will give me a solution. I have a table of item names like this:
Small trolley spiderman bag Large trolley spiderman bag Small spiderman pencilcase Round white rubber Small metalic double holes sharpener
I need a procedure or a function which allows the user to enter some parts of letters in any order and it returns the items which contain those letters. For example: When a user enters: "tr ma" the function returns the first item which contains the both words "trolley" and "Small" When a user enters: "sp" the function returns the three items which contain "spiderman"
I hope that I could explain the issue Thanks in advance for your help.
Hi..I am working With Asp.net using Vb for a Music Project.i have the requirment for serach songs according to catagory wise(Singer,Actor,Music Director, etc) i have code like this... If Not Page.IsPostBack Then searchword.Text = Request.QueryString("SearchWord") Response.Write(Request.QueryString("SearchWord")) Response.Write(Request.QueryString("Language")) Response.Write(Request.QueryString("SelectedCategory")) 'Response.Write(Request.QueryString("Query")) Dim str As String = "select * from Music_SongDetails where Music_Clip_Id>0 and Music_Clip_Lang='" & Request.QueryString("Language") & "'" If Request.QueryString("SelectedCategory") = "Song" Then str = str & " and Music_Clip_Name like '%" & Request.QueryString("SearchWord") & "%'" ElseIf Request.QueryString("SelectedCategory") = "Movie" Then str = str & " and Music_Folder_Name='" & Request.QueryString("SearchWord") & "'" ElseIf Request.QueryString("SelectedCategory") = "Actor" Then str = str & " and Music_Clip_Actor='" & Request.QueryString("SearchWord") & "'" ElseIf Request.QueryString("SelectedCategory") = "Actress" Then str = str & " and Music_Clip_Actress='" & Request.QueryString("SearchWord") & "'" ElseIf Request.QueryString("SelectedCategory") = "Music Director" Then str = str & " and Music_Clip_MusicDir='" & Request.QueryString("SearchWord") & "'" ElseIf Request.QueryString("SelectedCategory") = "Singer" Then str = str & " and Music_Clip_Singer='" & Request.QueryString("SearchWord") & "'" ElseIf Request.QueryString("SelectedCategory") = "All" Then str = str End If........... I need to write this code using Store Procedure.... Kindly Help me out Thanks in Advance
hi iam working with search for the first time,in the GUI i have 3 fields Audit Name,Year,Audit ID.After enetering any or all these details and pressing submit i must show the gridview with complete details. I have problem with the procedure for searching depending on the details given,here is the procedure: Select Aud.Ad_ID_PK,Aud.Audit_Name,Ind.Industry_Name,Cmp.Company_Name,Pla.Plant_Name,Reg.Login_Uname,Aud.Audit_Started_On,Aud.Audit_Scheduledto,Aud.Audit_Created_On from Industry Ind, Company Cmp, Plant Pla, RegistrationDetails Reg, Audits Audwhere Ind.Ind_Id_PK =Aud.Audit_Industry and Cmp.Cmp_ID_PK =Aud.Audit_Company and Pla.Pl_ID_PK =Aud.Audit_Plant and Reg.UID_PK =Aud.Audit_Engineer and Ad_ID_PK in (select Ad_ID_PK from Pcra_Audits) and year(Audit_Created_On)=year(@YrofAudit) order by Audit_Created_On DESC iam getting the data when the user enters year but i want the procedure where i can check for the three fields(Audit Name,Year,Audit ID) which user is entering.If he enters only one field it must check which field is enetered and must get the data.if more than one field is entered then all the conditions must be checked and must get the details.please help me.......... Its very urgent..Plz...
I am an inexperienced SQL programmer and need to write a SP which will be used to search a Call table within a Call Logging System used to log support calls for my company. The search criteria are fields like Call Reference No, Logged By, Call Status etc
The problem I have is that individual or a combination of these criteria may be used to search on -can anyone advise how I can write a SP which will take account of the possible different combinations of parameters which may be passed to the Stored Procedure
i.e. if 2 fields are populated during the search and 4 are empty
ALTER PROCEDURE usp_r_search_consultant @head_line varchar(150) ,@func_area varchar(150) ,@loc varchar(50) ,@exp varchar(50) ,@k_skills varchar(50) ,@operator char(1) --select * from RPO.dbo.REQUIREMENT_RESOURCE AS
if(@operator='A') BEGIN declare @sql varchar(1000) select @sql= --'select * from RPO.dbo.REQUIREMENT_RESOURCE where 1=1' '''SELECT Resume_head_line,Employer,CTC,Qualification1'' + '','' + ''Qualification2 AS Education,Current_city as Location,Preferred_Location From RPO.dbo.REQUIREMENT_RESOURCE (nolock) where 1=1'' ' print @sql
IF @head_line !='' begin SELECT @sql = @sql + ' and head_line='''+@head_line+''''
Hi to All, I am new to Prpgramming, I need to create a Stored Procedure for my requirement here is my requirement,I have two tables from those I need to get data. Table_One consists UserID,Name,Address,ContactInfo,EmailID, and Table_two consists UserID,CitizenShip,HieghestEducation,ExpectedJob But I need get data search report Name,EmailID,HiehestEducation,ExpectedJob. User should able to wile card search. Pls help me in this regards. Thanks in Advance..
Could anybody please tell me how I can search for a stored procedure in SQL Server 2005? I know the name of the stored procedure and I want to find in which database that stored proc is located/stored and I want to see the code of it. (I have all the necessaary previleges.) Please tell me how I can I do this.
I have a text box on my web form where the user can enter multiple comma delimited search words. The value from this text box goes to my search stored procedure in the form of a search string.
I am able to parse this comma delimited search string and get the words into a temp table.
If there are 2 words in the temp table then this is the sql that I want
select * from Items where (description like word1 or tagnumber like word1 or user like word1) and (description like word2 or tagnumber like word2 or user like word2)
description,tagnumber, user or the fields of the Items table.There could be any number of words in the search string.
Any ideas of how to get this done with any number of search words being matched against number of column/s.
I need to write a stored proc that will do the following :
Input : requestid
Logic : check the customers who already have a status of 'deleteme' and have now filed a status of 'addme'. For this, inside the stored proc, i will retreive the customername and address using the requestid and then check in the table for all the customers who have the samename, address and status=0. How can i detect this.
Output : 0 for no entry found and requestid if a request of 'deleteme' for the same person was found.
HIi want to create a procedure, basically i'll have 4 input parametres (Title, Category, ReleaseClass and BuyPrice)title will come from a textbox, the rest from dropdownlistsif a user enters a title, selects a ReleaseClass and BuyPrice, But doesnt select a category, all categories should be returned - You know what i meanhow do i go about this - Any Ideas??Cheers!!!
I have a few textboxes on a page that I would like to use as a search page and have clients shown in a gridview that meet the users entry into one or more of the textboxes. I have ClientID, LastName, FirstName, Address, and Keywords. How would I build a stored procedure to allow me to do this?
Hello, Is it possible to search in two tables, let's say table # 1 in specific field e.g. (age). If that field is empty then retrieve the data from table #1, if not retrieve the data from table # 2. Is it possible to do it by using SQL Stored Procedure?? Thank you