Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm writing a FullTextSqlQuery and would like to return all available columns in the result set.

When I specify the columns, e.g. SELECT Title FROM scope() WHERE ("scope" = 'All Sites'), the query works fine.

When I try to select all columns, e.g. SELECT * FROM scope() WHERE ("scope" = 'All Sites'), a QueryMalformedException is raised.

The code for the query execution is:

var sqlQuery = new FullTextSqlQuery(SPContext.Current.Site)
{
    ResultTypes = ResultType.RelevantResults,
    QueryText = searchQuery
};
var collectionOfResults = sqlQuery.Execute();

Is it possible to retrieve all available columns, or is there a workaround?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

AFAIK you have to specifically mention the columns you want.

In the SQL query, you are allowed to use the asterisk (*) to specify that all columns in a table are to be returned. However, no defined and fixed set of properties applies to all documents. For this reason, the SQL asterisk is not permitted in the [columns] setting.

http://msdn.microsoft.com/en-us/library/ms569178.aspx

share|improve this answer

FullTextSqlQuery uses a SQL-like syntax, but is not actually SQL. The query statement is parsed internally by SharePoint and used to query the flat index files generated by the crawler on the file system, as well as to generate real SQL queries which may be executed on the search database.

You therefore cannot use '*', and are limited to specifying only managed properties in your select statement. These properties can be defined in your SSP settings.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.