.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

Filter Vs Range - which would be fast in these query?

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :Sql Server

Hi All,


select {[Measures].[Cost]} on columns, NON EMPTY(filter([CALENDAR].[CALENDAR DATE].[All].children,
CDate([CALENDAR Date].[CALENDAR DATE].Item(0).MemberValue) >= CDate('2010-01-06') and
CDate([CALENDAR Date].[CALENDAR DATE].Item(0).MemberValue) <= CDate('2010-07-25'))) on rows
from (select (
{[Product].[Product TYPE].[STANDARD],[Product].[Product TYPE].[TRIGGERED],[Product].[Product TYPE].[Not Specified]},
{[Account].[ACCOUNT_NAME].[All].children}) on columns
from [Sales])
select {[Measures].[Cost]} on columns, NON EMPTY( 
[CALENDAR].[CALENDAR DATE].[06 Jan 2010]:[CALENDAR].[CALENDAR DATE].[25 Jul 2010]) on rows 
from (select (
{[Product].[Product TYPE]

View Complete Post

More Related Resource Links

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.  

QUERY filter dates by DAY

i have the following data : first column: dates and 2nd column: values i want to filter the dates per day and calculate the AVERAGE of their values per day i can filter them manually by setting day(datetimefield) = 12 and calculate the AVERGAE but i dont know how to do it for all in one query? each record resulting the average of that day   2010-07-12 00:00:00.000 900 2010-07-12 10:00:00.000 1000 2010-07-12 10:10:00.000 1200 2010-07-12 12:00:00.000 1100 2010-07-12 15:00:00.000 1300 2010-07-12 15:10:00.000 1500 2010-07-13 00:00:00.000 6500 2010-07-13 10:00:00.000 5500 2010-07-14 00:00:00.000 5500 2010-07-14 10:00:00.000 4400 2010-07-15 10:00:00.000 4500 2010-07-16 00:00:00.000 1000 2010-07-17 00:00:00.000 7000 2010-07-18 00:00:00.000 8500 2010-07-19 00:00:00.000 1500 2010-07-20 00:00:00.000 1700 2010-07-21 00:00:00.000 1900 2010-07-22 00:00:00.000 2000  

Filter out a subsite with Content Query

I'm using a sp 2007 Content Query to pull in news feeds from all over our site collecton.  I'd like to filter out one sub site using the "additional filters" option.   Is there a sub-site guid I could use, or a way to exlude one single site via the additional filter?   Thanks

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?

How to filter managed meta data column using page query string?

I have two managed term sets as follows: Articles:Downloads Projects:Downloads I am trying to use a content query web part to filter a list based on the above manged meta data column. I want to filter out only "Articles:Downloads" Scenario 1: When I edit the web part and directly set the filter option with the managed meta data column to "Articles:Downloads" it works fine. When I export the web part, in the .webpart file, the "FilterValue1" property has a value "Downloads|9096e43b-555d-4879-9acc-b4ada9ea9910". Scenario 2: I want the web part to get the filter information from query string [PageQueryString:pageType]. So I tried using these options: a) pageType=Downloads      This works but returns downloads under 'projects' as well. (i want downloads only under 'articles')  b) pageType=Articles:Downloads     Does not work and shows no records c) pageType = Downloads|9096e43b-555d-4879-9acc-b4ada9ea9910     Does not work. (This value is the same as one found in 'FilterValue1' of the static web part). c) pageType = Articles:Downloads|9096e43b-555d-4879-9acc-b4ada9ea9910     Does not work. d) pageType = 9096e43b-555d-4879-9acc-b4ada9ea9910     Does not work.   What am I missing here? Can some one please help?

MDX query to filter on specific dimension attributes

Ok, trying to figure out how to filter on specific dimension attributes. Are there any suggestions? I have a measure that needs to be filtered by a dimension that has numerous attributes (20 attributes in total) but I only want to show that measure against 10 of the attributes and once I get that result I need filter that result set against my time dimension (which this part I have figure out)   This is what I have so far: With member [calculated_measure_name] as ( [measures].[count_of_people], { [dimelgiblestatus].[elgible].[elgible1], [dimelgiblestatus].[elgible].[elgible2], [dimelgiblestatus].[elgible].[elgible3], [dimelgiblestatus].[elgible].[elgible4], [dimelgiblestatus].[elgible].[elgible5], [dimelgiblestatus].[elgible].[elgible6], }   )   Select [calculated_measure_name] on columns, [date].[fsicalyear].&[2008], [date].[fsicalyear].&[2009], [date].[fsicalyear].&[2010], [date].[fsicalyear].&[2011] on rows from mycube   When I run it, it gets no errors but in the result set for the numbers I get "#error"; do I need to basically create a subcube in order to get the result like I would like? If so how would I start doing that?   ThanksNetwork Analyst

How to apply dynamic filter in Datasheet View from Query String

The datasheet view doesn't support either connections/dynamic filters from Query string. How to filter the data using query string?

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  

Filter External List by a range of data

I have an external list web part that I am currently using a choice filter on to filter by a certain status.  The options are yes, no, or (empty).  However, I would like to be able to add an additional option to filter where the person has the previous status set to no, but has a value in a different field greater than 90. I realize that the choice filter probably wouldn't do this, and that I could do this easily with separate list views, where I have some sort of web part that can change the list views on the fly. I would think I could use one of those list filters to do this, but when I tried to do that for my original problem, I was unable to connect the filter to my external list. I could connect the list view filter to any internal list without an issue however.  Somebody commented on my old thread that I posted as cptInsane0 that I could just make an infopath view form that has buttons that do this.  I have dabbled with infopath a little bit, but I wasn't able to get infopath to connect to my external list either.  I first had to connect to an internal one, and then for some reason I could add the external list as an alternate data source. I can't be the first person who has had this issue. Could someone point me in the right direction?

T-SQL query, average of daily time periods over a date range



I'm building a report in Crystal Reports using a SQL command against a T-SQL 2005 telephony database.

I need to be able to run the query across a given datetime range, 6 months for example and bring back a 5 day display (Mon-Fri) with a group for every 15 minute interval in each day.

The group figures need to contain an average of the amount of calls presented for each 15 minute interval on any day across the whole datetime range, so for example the Monday 10:00 - 10:15 figure would be an average of all calls presented in every 10:00-10:15 range on each of the Mondays that fall within the datetime range.

I've got a query built now that gives total presented figures grouped by these intervals across one week but I can't figure out how to do this average function across a range.

Does anyone have any idea how I'd go about accomplishing this? I'm pretty new to SQL but keen to learn so any pointers on functions to research etc would be very much appreciated.

Thanks alot in advance, Andy.

Query for detail view across one week included below for table/fields etc...



count(DISTINCT Calls.SessionID) as Presented, min(Calls.startDateTime) as DateTime

INNER JOIN QueueDetail
ON Calls.sessionID =  Queues.sessionID
AND Calls.sessionSeqNum =  QueueDet

Query acting weird.. larger date range works in 1min 26sec and a smaller range say 1 month - 3 month


I have no clue why my query is acting weird

If i try to run it for 1/1/2010 9/30/2010 the query takes around 1min 26 sec and  return around a million rows

and If i run for 8/1/2010 to 8/31/2010 it takes forever to it...

basically i am getting data from 5 tables and putting it in a temp table and then updating that temp table 2-3 times with some information and then displaying it.

I am stumped as to why it works fast for a longer date range and runs the  snail for a small period of time..

I am in the verge of pulling my hair and going crazy..

any help will be appreciated.




Sending Query values in Fast queries are getting double escaped



I'm trying to send a query string using javascript to a Search centre Result.aspx page

I'm trying to send a value for s(scope) to search only for Intranet web pages. My when I submit this form I'm getting double escaped.

I'm actually trying to search for sdfsd in Intranet Web Pages scope my query string got converted to this-



%2b = + which I don't want.


jQuery("#QuickSearch").attr("method", "GET");<br/>
  jQuery("#QuickSearch").attr("action", gRes + "/searchcentre/pages/results.aspx");<br/>
  searchterm = trim(jQuery("#searchvalue").val())<br/>
  var validEntryPattern = (searchterm.length > 0);<br/>
  if (validEntryPattern == true) {<br/>

SharePoint List Query Filter


I am writting an SSRS report where I am querying a SharePoint list and trying to filter the data through the CAML query.  In BIDS, the query returns data, but the filter where clause doesn't seem to be getting recognized as I get all of the data back.  The where clause does seems to work in the U2U CAML Query Builder tool.

Can anyone please give advice as to why my where clause isn't working?


   <Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
         <Parameter Name="listName">
                   <DefaultValue>Subscribe - Sales by Product Group - Wheel</DefaultValue>

Is there a way to query entity based on multiple filter criteria? WCF Data Services, Linq to Entiti


Instead of:

DW_CMSOPEN dwc = new DW_CMSOPEN(new Uri("http://acctdev02/WCFDataService/EmployeeService.svc"));

dwc.Credentials = System.Net.CredentialCache.DefaultCredentials;

var employees = from emp in dwc.Employees 
             where emp.DEPT == "123"
             select emp;

I'd like the linq query to resemble:

var employees = from emp in dwc.Employees
              where emp.DEPT // in {"123", "456", etc}
              select emp;

Fast Query Language questions



I have some table in MS SQL Table (Id, title, body, creationDate). 

On Fast Search server side after crawling this table with JDBC connector I've mapped 'creationDate' column (as crawled property) to 'Created' managed property.

Now I want to query search web service with FQL query text syntax like this:


   <QueryText type='FQL'>near(cat, dog, N=3) AND... ?


Now, how I can add an expression for querying Created/creationDate values ?

I've been tried 'created:range(.., ..)' , 'Created &gt;= date1 AND Created &lt;= date2', but it always returns SoapException, with details that my query is malformed.


problem with date range between select Query in data adapter


hi all,

can any one help me out...why am getting "data type mis match error"

 DateTime dFromDate = dt_From.Value;
            dt_From.Value = DateTime.Parse(dFromDate.ToShortDateString());
            string From = dFromDate.ToShortDateString();

            DateTime dToDate = dt_To.Value;
            dt_To.Value = DateTime.Parse(dToDate.ToShortDateString());
            string To = dToDate.ToShortDateString();
            OleDbConnection cn = new OleDbConnection(ConfigurationSettings.AppSettings["connec"]);
            OleDbDataAdapter da = new OleDbDataAdapter("select * from Route_Expenses a where Entry_Date between '" +From+"' and '"+To+"'",cn);
            DataSet ds = new DataSet();
            dataGridView1.DataSource = ds.Tables[0];

 Please..its Urgent!

Query Web Service (FAST FQL) does not deliver the node RefinementResult (or QueryEx vs. Query)?


Hi *,

Looking for some clarification on this topic:

We are using the Query Web Service (search.asmx) from a web part and the web part send FQL formatted queries to the service. (e.g. <QueryText language="en-US" type="FQL">...). I f we execute the query with the method "QueryEx" (this returns a data set) we are able to find a node "<RefinementResults>" in the query result. This node is missing if we are executing the same FQL with the method "Query" (this returns xml) instead of "QueryEx". Is it possible to get this refinement result information also in the result by using the xml based answer? The xml returned by "Query" is much more appreciated as this contains more relevant details for our usage in the application.

Thanks in advance!

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