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

Top 5 Contributors of the Month
Post New Web Links

FullTextSqlQuery with Like returns no results

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :SharePoint
I have a problem with FullTextSqlQuery.  First I made sure I am using Office.Server.Search as you can see from the code below.  I have written the full namespace just to be sure :) Microsoft.Office.Server.Search.Query.FullTextSqlQuery myQueryFull = new Microsoft.Office.Server.Search.Query.FullTextSqlQuery(thisWeb.Site); Running this query it returns all the items in my custom list and scope - so far so good. myQueryFull.QueryText = "SELECT Title, Path,Description,Write,Rank,Size FROM SCOPE() WHERE \"scope\" = 'Car List Definition'"; The following also works fine and filters the elements correctly. myQueryFull.QueryText = "SELECT Title FROM SCOPE() WHERE \"scope\" = 'Car List Definition' AND FREETEXT('Toy*')" ;       BUT BUT BUT, the following returns empty list.  The same if I use Contains instead. myQueryFull.QueryText = "SELECT Title FROM SCOPE() WHERE \"scope\" = 'Car List Definition' AND Title LIKE '%Toy%'";       Any idea what's wrong? I am using sharepoint 2010. Thanks

View Complete Post

More Related Resource Links

SharePoint Search Server 2010 Express returns no search results for non-admin users

This is going to sound crazy, but anyway... bare with me... I have a SharePoint Search Server 2010 Express (RTM) installed with a crawl account (call it sharepoint_crawl) which has full read permission to an entire site collection of 100,000 documents. I have logged in with this account to make sure it has read access to everything, and it does. I run a full crawl of all documents and allow it to finish. If I try and search the content for an extremely common term (i.e. 50,000+ hits) I get no results. However, if I log in with a site collection admin I do get search results. There are no indexing errors or query errors in either log files or event log. Everything looks like it is working correctly - just no results for non-admins Anyone tripped on this? I have recreated the crawl account and perform a full re-index with the same results. What gets me is that the crawl account does have read permission to the content it is indexing, the content is indexed correctly, but the crawl account cannot get results back. It is as if security-trimming is removing everything. Any ideas?

show a "no results" message if a db query returns nothing

I inherited some C# code behind that queries a database table and need to add something that displays a "No results" message (using a Label web control, perhaps) if the query doesn't return any records. I'm just learning C# but am coming up short on how to do this. Would anyone be kind enough to point me to an example, or demonstrate? Thanks a lot. Here's the code I inherited (the programmer who wrote this is no longer available). This is the code behind from the search results page:using System; using System.Text; using System.Data; using System.Data.Common; using System.Data.SqlClient; using System.Collections; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Maine_Innkeeper_Site_2010 { public partial class lodging_search_output : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string sql = Session["logdingSearchSql"].ToString(); SqlCommand cmd = common.openDatabase(); cmd.CommandText = sql; string PreviousTown = ""; try { StringBuilder sb = new StringBuilder(); SqlDataReader rdr = cmd.ExecuteReader(); sb.Append("<ul class=lodging-search-initial-results>"); while (rdr.Read()) {

Error accessing Search Settings and search returns 0 results

Quick summary - my MOSS 2007 server died. I brought up a new server, installed MOSS, service pack 1, service pack 2, created the new config database, then attached my existing content database (I have a separate physical server for the databases). After a few tweaks to get most of the other settings back in order, (most) everything seems to be working somewhat as it should except for Search. Whenever I try to access Search settings I get an error: "An error occurred during the processing of . The resource object with key 'S2SearchAdminDashboard_Title' was not found". I created a new SSP with it's own unique account for the service and app pool (read online that it should be different than SharePoint account because of the timer service conflicting with search), I tried copying the files (listed here: http://social.technet.microsoft.com/Forums/en-US/sharepointsearch/thread/1a93ef86-be5a-44ad-a814-14613fd0a78f) from my test environment with no luck, I've made sure the permissions to the Task Scheduler were correct (found a Google blip about that somewhere), I've deleted and re-installed the SSP multiple times, ran the Configuration Wizard more times than I can count, but no matter what I do it never changes and always gives the same error. Also, whenever I try to access Central Admin it tries redirecting me to http://servername:portnumber/_admin/SearchServerW

Stored procedure returns two select results


Hey guys

I am creating a buddy list and I need to select my entire buddy list and then the ones that are online

I have two querries one is your standard


FROM buddies


the other is a bit more complicated


SELECT Buddy as Online
FROM Buddies
FROM online 
WHERE online.Buddy = Buddies.Buddy)

I can't use the union command since I create another column

What I would like is to append the column to my original result so I can access it from some vb script using the sqlclient.datareader


Search This Site: Returns no results.



I am in the process of implementing MOSS 2007 and we have 2 site collections.   When we get to either site there are 2 search option This Site:  and All Sites.   All sites returns all the results but when search This Site I get no results.     We removed the People Scope because we aren't implementing mysites with the first release.    



Does anyone have any suggestions.   I had Microsoft on the phone yesterday but they didn't seem to be able to help.  


Reset HiddenField if AutoCompleteExtender returns no results


Hi i need to be able to reset a HiddenField's value if my AutoCompleteExtender returns no results (specifically, if the user searches for something that's not in the list/database). I have this JS code now:

function autoCompleteItemSelected(source, eventArgs) { 
    var assocHiddenField = document.getElementById(source.get_id() + '_hidden'); 
    assocHiddenField.value = eventArgs.get_value(); 

How would I modify this to check if the list is null? Currently it seems to just leave the value as it was previously.


GetUsageData() returns inaccurate results


I am trying to get information on site visits using the following function:

private static void PrintUsage(SPWeb web)
  SPUsageReportType reportType = SPUsageReportType.user;
  DataTable dataTable = web.GetUsageData(reportType, SPUsagePeriodType.day, 1, DateTime.Today);

  if (dataTable == null)

  foreach (DataColumn col in dataTable.Columns)
    Console.Write(col + " | "); 


   foreach (DataRow row in dataTable.Rows) 
     foreach (var item in row.ItemArray)
      Console.Write(item + " | "); 

The function is getting invoked like this:

SPSite siteCollection = new SPSite(

FullTextSqlQuery returns the right number of rows, but they have no data!


Hey all,

I'm running my first fulltextsqquery, using the function below - it seems to all execute fine and 24 rows get returned (query below) which sounds about right for all the people on my site. What's weird though is that all the columns in the results are empty string ("" or {}) - they definitely aren't empty in the user's profile - can anyone help me? Preferred email is a custom field and is mapped onto a People:PreferredEmail(Text) property in search admin - anything else i need to do?

 string query = string.Format("SELECT {0},{1} FROM SCOPE() WHERE \"scope\"='People'""PreferredEmail", "FirstName");
 public static ResultTableCollection RunFullTextSqlQuery(string sql, int rowLimit)

GetUsageData() returns inaccurate results


I am trying to get information on site visits using the following function:

private static void PrintUsage(SPWeb web)
  SPUsageReportType reportType = SPUsageReportType.user;
  DataTable dataTable = web.GetUsageData(reportType, SPUsagePeriodType.day, 1, DateTime.Today);

  if (dataTable == null)

  foreach (DataColumn col in dataTable.Columns)
    Console.Write(col + " | "); 


   foreach (DataRow row in dataTable.Rows) 
     foreach (var item in row.ItemArray)
      Console.Write(item + " | "); 

The function is getting invoked like this:

SPSite siteCollection = new SPSite(

sp_validatelogins returns unexpected results




On a 2005 SP3 SQL box, as part of an audit I ran this sp and the results it returns appear to be incorrect.


It returned  DOM\SQL Users, a windows group I asked our AD Admins to set up. We have a e-business app that authenticates using this group so I know it's valid and I know works otherwise my phone would be ringing off the hook.


To make sure I wasn't going mad though,  I asked out AD Admins to verify that this group exists and is enabled. It was, of course.


So then I xp_logininfo to see what it said:


EXEC xp_logininfo 'DOM\SQL Users

Search returns no results for non admin users

Hi all, I can't seem to get search to return results for non-admin users. I can search fine as the administrator - but non admin users, although they can see the rest of the site content with no issues, they can't get any results on the search. I'm using MOSS 2007 on a server farm - the search config appears to be set up correctly but I can't find any info on why it might not be returning results for non admins - I would have thought security trimming would have stopped users from seeing content - so is there some way that users would be able to see the site but still not have 'real' access to it?

Passing parameter to Subreport dataset query returns no results



I'm using the subreport as a workaround to not being able to join two disparate datasets. The "tickler" file  of keys comes from an Access DB defined as a dataset in my main report. The subreport has a dataset query using parameters from the main report. 

When subreport returns no results, I want to display an error message in the main report and continue to the next row key processing. How do I accomplish that?


MOSS People search returns no results


I've done a fresh install of MOSS 2007. We have a farm with 1 web server, 1 query server, 1 index server.

I'm having issues with our people search. Our My Sites are on a seperate web application http://mysite

I have imported the user profiles from AD with no errors. My sites can be created with no problems. The only issue is when using people search it returns no results.

I've checked the crawl logs and im getting 2 errors

Error in the Site Data Web Service.

Error in PortalCrawl Web Service.

I cant see anything in the event viewer relating to this. The normal content search is working fine. Can anyone help me?

Thank in advance

WebRequestMethods.Ftp.GetFileSize returns inconsistent results


The FTP server of interest is probably Unix type and the uploaded files have different sizes than their local counterparts residing on a computer running Windows.

The following is what I observed.

1. After uploading a file using WebRequestMethods.Ftp.UploadFile, the file size retrieved immediately by using WebRequestMethods.Ftp.GetFileSize is exactly the same as the local file size  which is not correct.

2. After a bunch of FTP operations, the file size retrieved by the same method (i.e. using WebRequestMethods.Ftp.GetFileSize) is the correct size which is different from the local one.

This may be an FTP server issue.  I am asking just in case it is related to how FtpWebRequest works. 

Could  anyone shed some light on this?



SSIS Package Returns Different Results When Run As Job


Hi Everyone,

I created an SSIS Package and when I run it by executing the package from within Visual Studio or by executing the package from within the SSIS interface in SQL Management Studio, I get the same result.  However, if I execute the package using a SQL Agent job, I get a different result.  The first two execution methods return 30k rows and the SQL Agent method returns 26k rows.  I am using the same login for everything (the SQL Agent job is being run with a proxy with the same credentials that are used to run SQL Management Studio).  I tried deleting the job and the package and creating new ones.  I restarted everything.  Version is SQL Server 2005.  Any help would be greatly appreciated.  Thanks.


FullTextSqlQuery in SharePoint returns zero rows


Need to make a custom people picker in my custom web application that will be hosted on SharePoint.  To populate my search, I am making an AJAX call to a web service running the following code:





using (SPSite oSite = new SPSite(

Query a Table with Japanese Characters returns always 0 results


Hi all, I wonder if you could give me a hand on this please...

I've a table (lets say with 2 columns: ID int, Vendor Name nvarchar(255)) with some records with Japanese Characters. 

When I try to query that table for the specific rows with Japanese string I always get 0 results.


Table example:


ID Vendor Name

1 Bruno Ferreira

2 ??????????


Query Example:

select * from myTbl where [Vendor Name] collate <<collations name>> = '??????????'


Result always nothing...


I've tried with all the possible available collations but with no luck

collations I've tried:











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