.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

The first axis of the query should not have multiple hierarchies

Posted By:      Posted Date: October 01, 2010    Points: 0   Category :Sql Server







[Calendar Date].[Calendar Hierarchy].[0-90]






View Complete Post

More Related Resource Links

LINQ query with multiple joins, problem


I am using a LINQ query with multiple joins, the last join does not return any values even though values exist in the database. Below is my code.

when the query returns suiteNameTrg and SuiteTypeTrg are empty, all other values are returned correctly.

string suiteNameTrg = string.Empty;
            string suiteTypeTrg = string.Empty;
            using (DataClassesDataContext db = new DataClassesDataContext())
                    var productQuery = from assets in db.ASSETs
                    join relocatableUnits in db.RELOCATABLE_UNITs on assets.RUID equals relocatableUnits.RUID into assets_units
                    from relocatableUnits in assets_units.DefaultIfEmpty()
                   join build in db.BUILDINGs on assets.BUILDING_ID equals build.BUILDING_ID into assets_bins
                   from build in assets_bins.DefaultIfEmpty()
                   join test in db.TEST_SUITEs on assets.TEST_SUITE_ID equals test.TEST_SUITE_ID into test_bins
                   from test in test_bins.DefaultIfEmpty()
                    join testTrgt in db.TEST_SUITEs on assets.TARGET_TEST_SUITE_ID equals testTrgt.TEST_SUITE_ID into testTrgt_bins
                    from testTrgt in testTrgt_bins.DefaultIfEmpty()

                    select new

Running a single SQL update query on multiple foxpro databases

Hi, Env : SSIS 2008 My requirement is to run a update SQL statement on multiple foxpro databases. The fox database paths are available in a SQL server table.  I've created a for each loop control and assigned the database path to a variable named dbpath. Within the loop, I added an "execute sql task" control. Now what properties are to be set to get the requirement done. Appreciate any help. Regards. BH  Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful. BH

Inserting multiple records under the single query

Hi All,       I have to insert a multiple records under the single table.So i have to execute the command in the frontend for every records. Inorder to avoid i write the query like this   insert into table1(field1,field2) values('1','Test1'),('2','Test2'); and also i tried insert into table1(field1,field2) SELECT "1","Test1" Union all SELECT "2","Test2" But I am getting syntax error. How to insert a multiple records under the single query???...

CAML query to access List data across multiple site collection.

Hi   Is there any way to get the Task List data across multiple site collection using CAML query. Currently, I have the code which will retrieve the data from a single site collection. Below is the code.                           /***************************************************I am using Moss2007.Thanks!Ravi             SPSiteDataQuery q = new SPSiteDataQuery();             q.ViewFields = "<FieldRef Name=\"Title\" />" "<FieldRef Name=\"Status\" Nullable=\"TRUE\"/>";             q.Lists = "<Lists ServerTemplate=\"107\"/>";             q.Webs = "<Webs Scope=\"SiteCollection\"/>";             q.Query = "<Where>" +                                "<Eq>" +                                     "<FieldRef Name=\"Status\" />" + "<Value Type=\"Choice\">Not  Started</Value>" +                                     "</Eq>" +                         "</Where>";             DataTable dt=null;             using (SPSite s = new SPSite("http://banglabguest1:31000/"))             {                 SPWeb w = s.OpenWeb();                 dt = w.GetSiteData(q);                 w = null;             }                              *************************

Adding a table or view multiple times when building a query with BI Report Designer and Report Build

How can I add a table/view multiple times to a single query by using BI Report Designer or Report Builder 3.0? In Report Designer I managed (workaround) to add one table multiple times by creating multiple Named Queries and having the same SELECT. Still I don't know how to add one table multiple times in Report Builder 3.0.

Multiple Dates Query


I need help in creating a query to get info for year selected and previous year of the year selected. Needs to be by quarter(QTR) for both years. QTR1 will always be the month 03, QTR2 month 06, QTR3 month 09, & QTR4 month 12. No computations are required or averaging.

Fields/columns are YEARMONTH stored as mm/dd/yyyy with dd always being 01, ACTUAL_MONTH(float)for all QTRs based on current YEARMONTH selected and one year prior,TARGET_MONTH(float) for all QTRs based on YEARMONTH selected, and PROJECTION_MONTH(float) for all QTRs based YEARMONTH selected.

YEARMONTH (PK, Datetime)

Should look like this if any YearMonth in 2010 was selected
                   Q1 Q2 Q3 Q4
09-Actual      xxx xxx xxx xxx
10-Actual      xxx xxx xxx xxx
10-Target      xxx xxx xxx xxx
10-Projection xxx xxx xxx xxx

Multiple value checking in Caml Query.

    i would like to check the multiple values in caml. for example In operator in sql server . all helps are appreciate .

Calculated measure that works across multiple hierarchies

Dear all,

I need to create a calculated measure for YTD that dynamically calculates based on the date hierarchy selected by the user (SSRS & Excel).

On the date dimension, I have 2 hierarchies "Year-Month-Day" and "Year-Week-Day", that both share the year and day attributes.

What's the best way to go about this?

Many thanks,


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;

SQL Query Multiple rows Top problem.

This is a simplified example of my problem.
I have a Product table, and a ProductSupplier table.  A Product can have multiple Suppliers; these suppliers are ordered according to a sort order field and each has an associated price for the Product.

I want to run a query to return all my products, along with their first supplier and the cost against this supplier.

Currently the only way I can do this is by performing select statements in the manin select clause to retrieve the supplier information.






visualization of multiple parent hierarchies


I have table like

HierarchyId     EmployeeId     ParentId


1                     1                      0

2                     2                      3

3                     3                      1

4                     3                      2

see, employee id 3 has two parents, 1 and 2. The same situation may arise for other employees also. How can I visualize this hierarchy in my webpage? what would be the best

Retrieving multiple values from a select query



This code works just fine for me to select * from x,y,z. However what I want to do is retrieve the values return and assign them to variables. How do I go about this? Thanks in advance.


 Using MyConnection As New SqlConnection("Data Source=sql2008.aspnethosting.co.uk;Initial Catalog=xxx_xxxx;Persist Security Info=True;User ID=xxx_xxx;Password=xxxxx")
            Dim MyCommand As New SqlCommand("SELECT txfrequency,mode,details FROM frequencies WHERE county = @location", MyConnection)
            MyCommand.Parameters.Add("@location", SqlDbType.NVarChar).Value = e.PostBackValue
            Dim r As SqlDataReader = MyCommand.ExecuteReader()
            GridView1.DataSource = r
            'SELECT COUNT(*) FROM TableName WHERE SomeWhereClause 
        End Using


Multiple Parent Child Hierarchies in SSAS 2008 R2


I'm trying to create a dimension containing financial accounts in SSAS 2008 R2 where individual accounts can belong to one or more hierarchies.  I also need to be able to specify a unary operator since a leaf level account may be subtracted from one parent but additive to another parent.  For example revenues and expenses may be grouped one way for statutory reporting and a completly different way for management reporting and further belong to some arbitraty groupings that users find necessary.

I can't seem to find a way to have a leaf level member in a dimension more than one time in a Parent child hierarchy, and I can't seem to find any way to include the unary operator in a hierarchy where I use attributes to define the hierarchy.

Are there any work arounds that anyone knows about?  What I found from the help file was that multiple parent child hierarchies which supported in SSAS 2000 are not supported in 2008.  However there is no suggestion for what to do.

Any insight would be greatly appreciated.


Bill Webster

Lookup field which allows multiple choice - problem when query with CAML


I created one simple list and added one column - lookup - I've chosen some source list and field, then marked "Allow multiple choice". I created new item in that list, by adding more than one valie to that coulm.

The problem is, when I use CAML query, that column has such values:


and it's suppose to be like this:


do You have any idea, why it doesn't query first ID?

Can a single Parameter be used for multiple columns in the query.


Hi all,

I was trying to create a report with a slight different kind of requirement,

Actually I have 5 Columns in a table from which I want the user to be capable to view the data based on any combination for those columns.

For Example:

I have a table Employee with attributes: Name / Age / Salary / STATE

Now I want the user to be capable of selecting any combination for these columns and then running the report, Actually the report will behave like a Select Query with Where clause with AND conditions for all columns.

Report design should be like this:

FIRST prompt:   Select Column name  ex: AGE

SECOND prompt:   Select Column Value ex: 30

(now store this value somewhere and allow the user to again select a different column name like STATE, and the SECOND prompt will show all distinct STATEvalues, then user selects for ex: NEW YORK

Then when USER clicks VIEW REPORT:

Show all the employees where AGE = 30 and STATE = NEW YORK.

Is it possible ? as I dont want to create 10 prompts for 5 columns separately.

Any help is appreciated.



Search query with multiple search feilds



I have a search page with four fields. Each field belongs to columns in the database. None of these fields are mandatory, so user can choose which field/feilds they want to enter. I want the search results to be more specific as they enter values in more than one field.

For example.

First name, Last name, Pin code and Mobile are the 4 search fields.


Any help will be appreciated.

Thank you


Create multiple XML files from a single query



I'm using this code for creating and xml file out of a SQL2005 table:

select (select 
    from ProductsInfo_ZAP p
    for xml path('PRODUCT'),TYPE, ROOT('PRODUCTS')
) for xml path(''), ROOT('STORE')

Is there a way for me to create multiple xml files, one for every row, going by the primary key column, or do I have to create a separate query for each row?

I would also wondering what is the syntax for transforming this query into a stored procedure


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