.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

search query

Posted By:      Posted Date: October 09, 2010    Points: 0   Category :ASP.Net

how do i create search query may table is following

id              name                       Description    

1               tom                           this  safis a tom which belongs to UAE

2               David                        This name Issssds so beautiful

2               David                        a tlkjioukjliouklj

i want to search those record where i give

input                 is


table will display as foll

View Complete Post

More Related Resource Links

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

FAST search query is slow...

Hi, we are using fast search for sharepoint 2010. We are crawling an external data source and this is used for search queries. we have around 30 metadata properties and all are full-text indexed. however, the search operation is slow for a database of 5k records in intranet (webserver and database server are in different geographic regions). typically a 100 item search takes 9-10 sec. it get worse over internet and the search query varies from 10-45 sec for 100 items. Any pointers will be helpful. thanks.  

DateTime custom managed property search fails with " Your query is malformed. Please rephrase your q

I've created a front end search page in Silverlight 4 for SharePoint Search.  Currently we are using WSS 3.0 + Search Server Express 2008 (v  The page interacts with the MOSS version of the search web service at:   <site collection>/_vti_bin/search.asmx The reason for this approach is the unique way the requirements specify the look and behavior of the results.  The built-in Search Center page or web parts will not satisfy these requirements. We are going into production but I still cannot figure out how to search against my custom managed properties that are of Type DateTime.  If I cannot get this to work, it is a showstopper. I've tried numerous variations on the SQL Syntax and cannot get it to work.  I know the error is in the date portion of the WHERE clause since I can remove it and searches work fine. Here is a working query: SELECT Size, Rank, Path, Title, Description, Write, RequestSubmittedDate, DocumentType, RequestPromisedDate, ProblemDescription, DatePublished, RequestOwner, RequestingDepartment, DocumentAuthor, ProjectNumber, ProjectDescription, RequestStatus FROM scope() WHERE CONTAINS ('"nmr"') ORDER BY "Rank" DESC yet if I try to use a date literal in the WHERE clause as in the following query modification, I get the "malformed"

Search query returning 0 results

I'm using a query which returns 0 results but was working some weeks ago.  I checked the code and nothing has changed since then.  I created a Search Center Site on another port and using the same terms I get many results there.  I checked my scopes and they are all right. Nothing changed there either. Could someone help me figure out what may be the problem in my query.  Or maybe it's my Scopes/Content Sources configuration. SELECT URL, FileName, Title, Description, Rank, Size, HitHighlightedSummary, Path FROM SCOPE() WHERE freetext(defaultproperties, ' +légumes')  AND ( "scope" = 'Scope - My Portal - All Site - fr'  )    ORDER BY Rank DESCDaniel Siconnelli There is neither good nor evil... only mogwais and gremlins

How to Perform Query Side Expansion of Synonyms in FAST Search for SharePoint

Hi, I have added Two Way Synonyms in FAST Search Keywords option in Site Settings. If I type the synonym alone, it works but if I type it with some other keyword, the search results in no hits whereas with the Same Keyword if i give the Main Keyword instead of its synonym, the search is successful. I understand that for this we need to do Query Side Expansion of Synonyms. I also tried to Set a Resubmit Flag to AddSynonymsAutomatically but this also failed. Can u pls suggest a way for this?

FASTSearchQueryException encountered when creating FAST Search query scopes in PowerShell

Hi, I made an update to an existing FAST Search query scopes. The updates are on the ExtendedSearchFilter parameter. Since the Set-SPEnterpriseSearchQueryScope PowerShell cmdlet does not work to update the parameter, I removed the existing scopes using Remove-SPEnterpriseSearchQueryScope and created new scopes using the New-SPEnterpriseSearchQueryScope cmdlets. I have noticed that after creating the scopes, I sometimes encounter the "The search request was unable to execute on FAST Search Server" (FASTSearchQueryException) when executing query against the search scope. I am not sure if the exception is related to how the scope objects are disposed after running the Remove-SPEnterpriseSearchQueryScope cmdlet. I tried to look into the Event logs of the FAST search server but I was not able to see the error. I would like to ask the community if the exception can be attributed to the exsiting scopes that were removed then recreated.  Thanks. Jo-an  

How to hide "No results are available. Either no query is specified..." in Core Search Results webpa

Hi All, by default core search results webpart displays this message "No results are available. Either no query is specified, or the query came from advanced search (Federated Webparts do not support Advanced Search queries)." till you perform your first search. So, how can i hide this message when page loaded ? Thanks,

dynamically add coulmn name in sql query for search


i want to add add coulmn name in sql query at run time and if any field is blank or null  than it should not goes with sql query for search ....

column name:




SqlCommand cmd = new SqlCommand("select * from hotelreg where '" + firstName.Text + "' and '" + lastName.Text + "', and '" + address.Text + "' like '%"+textbox1.Text+"%'", con);

plz reply me

Search error-Query component status initialzing


When I try to search anything on my sharepoint site its is showing Internal Server Exception.

When I looked into the Central Administartion->Search Service:Search Administration,the Query Component 0 status is stuck on

initilialzing.So how can I solve this and make the query component 0 online.

Search and replace of query


hi i have many stored procedures in which i want to search for text "user_Id" and want to replace it with "userId" in a query , not manually.

i know how to get names of such queries which contain "user_Id" but don't know how to replace it through sql query

advanced search query


Hi all,


I try to customize the advanced search  web part and form my own query which I add to ASB_ResType_Query.

the problem appear when with 1 text box value I need to look into several properties and I combine several field like that in my query.

My query can became very long like below:

Full Text Query:

SELECT Name, Title, Path, SiteName, CollapsingStatus, HitHighlightedSummary, HitHighlightedProperties, ContentClass, IsDocument, PictureThumbnailURL

from scope()

where ("scope" = 'All Sites') And ((FREETEXT(DLName,'document') OR FREETEXT(DLfName, 'document') OR FREETEXT (DLTitle,'document')) AND ((DLCompName ='Town) OR (DLAirport = 'Town') OR (DLExtComp = 'Town') OR (DLComp = 'Town') OR (DLRelevantComp = 'Town') OR (DLCorrespondent = 'Town')))

These always give me a no result or sometimes your query is malformed.

hope anybody can point me what is wrong with my query or which approach should I take to make it works.


Thank you all

Best regards,
-- Pingkan --

SQL query to allow user to search


In my webpage I have a textbox where the user can type information that they want to search by.  I need to take the user input and build a sql query to return records.  I have tested my query in sql and it works hardcoding parameters, however I am having trouble getting the user input dynamically and populating my query string.  Can someone help me figure out how to get the user input to populate my query string???

Here is my code:

 //Define query
        string sql = "SELECT CustomerID, FirstName, LastName, Email, City, State, Phone FROM dbo.Customer WHERE (FirstName LIKE '@SearchParms') OR (LastName LIKE '@SearchParms') OR (City LIKE '@SearchParms') OR (State LIKE '@SearchParms') ORDER BY LastName, FirstName";

        //Declare the Command
        SqlCommand cmd = new SqlCommand(sql, Conn);

        //Add the parameters needed for the SQL query
        cmd.Parameters.AddWithValue("@SearchParms", '%' + txtCustSearch.Text + '%');  

        //Declare a SQL adapter
        SqlDataAdapter da = new SqlDataAdapter(sql, Conn);
        //Declare a DataTable
        DataTable dt = new DataTable();

        //Populate the DataTable

        //Bind to listview
        lv.DataSource = dt;


search service application:Query component error


I tried to create a new query component using powershell commands

PS C:****> $ssa = Get-SPEnterpriseSearchServiceApplication
PS C:****> $qtOld = $ssa | Get-SPEnterpriseSearchQueryTopology -Active
PS C:****> $ssInstance = Get-SPEnterpriseSearchServiceInstance -Local
PS C:****> $qtNew = $ssa | New-SPEnterpriseSearchQueryTopology -Partiti
ons 1
PS C:****> $idxPartition = (Get-SPEnterpriseSearchIndexPartition -Query
Topology $qtOld)
PS C:****> $queryComponent = New-SPEnterpriseSearchQuerycomponent -Quer
yTopology $qtNew -IndexPartition $idxPartition -SearchServiceInstance $ssInstanc


and I am getting the following error:

New-SPEnterpriseSearchQueryComponent : Query component can be created only for
partition from the same topology.
At line:1 char:55
+ $queryComponent = New-SPEnterpriseSearchQuerycomponent <<<<  -QueryTopology $
qtNew -IndexPartition $idxPartition -SearchServiceInstance $ssInstance
    + CategoryInfo          : InvalidData: (Microsoft.Offic...hQueryComponent:

Search service application - Query component


In my search service application the 'query component' is stuck on the 'initialzing' status.So I googled to fix that error and found an article.


below the heading search fix.But I have some doubts regarding that.


In that post it has mentioned about the 'SetupEnterpriseSearch.ps1' and the configuration file 'searchconfig.xml'.

As mentioned in the first step of that article : How can i load the SetupEnterpriseSearch.ps1 to the powershell and what all things I need to change inside that file.Can anyone please explain that in detail.

In the second step : Execute “Start-EnterpriseSearch “<path> \searchconfig.xml”" what is the path that need to be specified and what all things have to be changed inside that config file.

Please help .Thanks in advance.


SharePoint 2010 sql search query issues



I am using tool for testing SharePoint search queries (http://blogs.technet.com/b/speschka/archive/2010/08/15/free-developer-search-tool-for-sharepoint-2010-search-and-fast-search-for-sharepoint.aspx). I have tested some queries and received some strange results. For example:


SELECT Size, Rank, Path, Title, Description, Write, Filename, FileExtension FROM scope() WHERE CONTAINS (Title, 'get') ORDER BY Rank DESC

This query returns two results for me. And next one returns no results.

SELECT Size, Rank, Path, Title, Description, Write, Filename, FileExtension FROM scope() WHERE Title LIKE '%get%' ORDER BY Rank DESC

However I was expecting to receive two or more results.


Another example is:

SELECT Size, Rank, Path, Title, Description, Write, Filename, FileExtension FROM scope() WHERE FileExtension = 'txt' ORDER BY Rank DESC

This query returns one result for me. And next one returns no results.

SELECT Size, Rank, Path, Title, Description, Write, Filename, FileExtension FROM scope() WHERE CONTAINS (FileExtension, 'txt') ORDER BY Rank DESC

I was expecting at least one result from this query. I would like also to mention that issue #2 is reproducible for FileExtension property only.

Could anyone please help me with these issues. Thanks beforehand for any help.


Impersonation of FullTextSqlQuery search query



I am using FullTextSqlQuery class (http://msdn.microsoft.com/en-us/library/microsoft.office.server.search.query.fulltextsqlquery_members.aspx) to perform search for SharePoint 2010 sites.

I would like to execute search query under some specific user permissions. I suppose I should use FullTextSqlQuery.PersonalizationData to impersonate search query. This property requires User's GUID as parameter. The question is how may I get user Guid for some user. SPUser.ID returns integer value. Is there any way to get user guid as System.Guid type? or impersonate search query in some other way. It should work both for windows and claims users so windows impersonation is not acceptable.

Thanks beforehand,


Usage Reporting and Search Query reporting in WSS 3.0


Hi Every one,


I have a following requirement:

I would need to generate a report/fetch the details of what the users are searching for ---->search query logging 

I would need to fetch the details of the most used content from the site ---Site usage logging.


Could you please provide me the solutions how i can proceed in WSS 3.0 







Thanks keshav,Share point Developer
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend