Tuesday, March 20, 2012
Query Evaluvation and tempdb
Does SQL server store the intermediate results set in the tempdb? One of the
team members has dropped the indexes for our one large table. I was running
a
query that has multiple joins (including this table) , and this caused tempd
b
to fill up.
According to this article by Microsoft,
http://msdn2.microsoft.com/en-us/library/ms190768.aspx, I'm under impression
that table scan has stored a large set of intermediate data in tempdb, whic
h
caused it to fill up.
My team members seem to argue that temp db is only used when we use temp
tables.
Secondly, does sql server evaluate the join first, or where clause first?
(Or it depends on each query?)
Thank you much for your help in advance.> My team members seem to argue that temp db is only used when we use temp
> tables.
Your team members are wrong. Tempdb can be used for sorting on just about
any type of query. Also see a list of items here under "Causes":
http://www.aspfaq.com/2446
A
Wednesday, March 7, 2012
Query calculated OLAP members
retrieve only the dimensions and measures, not the calculated members.
My query is:
select * from MasterCube
Is there any way to extract them?Below is a sample MDX query (used in the sample Foodmart reporting services
report) which includes a calculated measure, Store Cost.
SELECT { [Measures].[Store Sales], [Measures].[Store Cost] } ON COLUMNS,
{ Descendants([Product].[All Products], [Product].[Brand Name], LEAVES) }
ON ROWS,
{ Time.[1997].[Q1],Time.[1997].[Q2],Time.[1997].[Q3],Time.[1997].[Q4] } ON
PAGES
FROM Sales
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Cesar Meza" <CesarMeza@.discussions.microsoft.com> wrote in message
news:0A29D2FD-F3CF-4772-A063-E585C6B1DDA3@.microsoft.com...
> I'm trying to create a report using an OLAP cube as my data source, but I
> can
> retrieve only the dimensions and measures, not the calculated members.
> My query is:
> select * from MasterCube
> Is there any way to extract them?|||The real issue this: I have a cube that is too big for Excel's Pivot table to
handle it. So I'm trying to export it as PDF report using RS.
So I have several formulas that rely on the Analysis Services functionalliy
(aggregates, ranking, etc.) that are already in the cube.
I know I can write the MDX statement to recreate them, but this will mean to
re-create all the calculated members once more in the statement.
Any suggestions?.
Thanks a lot for your response.
Query Calculated Member - Member Properties
I have an urgent problem with some queries including calculated members where I want to filter by properties..
I have rewriten my query to show my issue on the Adventure Works Database.
Code Snippet
with
member [Account].[Accounts].[TEST] as 0
/* create a new query calculated member in the hierarchy */
select
{} on columns,
{
filter(
{
descendants([Account].[Accounts].&[1], 2)
,[Account].[Accounts].[TEST]
/* use the new calculated member */
/* comment out the calc member to see successfull execution */
},
[Account].[Accounts].CurrentMember.Properties("Account Type")="Assets"
/* filter by a member property which does not exists on the query calculated member - error */
)
}
dimension properties
[Account].[Accounts].[Account Type],
[Account].[Accounts].[Account Number],
[Account].[Accounts].[Accounts]
on rows
from
[Adventure Works]
I create a calcuated meber - and then I want to use this in a filter by member property. The Server always raises the error that the property does not exists.
How to solve this error?
The Documentation http://technet.microsoft.com/en-us/library/ms146017.aspx specify a possiblity to specify the property for the member - but I was not able to this - like documented It has no effect.
I need some urgent Help, HANNES
If you want filter to remove the calculated member then use stripcalculatedmembers function to remove all calculated members from the 1st argument. If you want filter to retain the calculated member then use the iserror function like below:
with
member [Account].[Accounts].[TEST] as 0
/* create a new query calculated member in the hierarchy */
select
{} on columns,
{
filter(
{
descendants([Account].[Accounts].&[1], 2)
,[Account].[Accounts].[TEST]
},
iserror([Account].[Accounts].CurrentMember.Properties("Account Type")) or [Account].[Accounts].CurrentMember.Properties("Account Type")="Assets"
/* filter by a member property which does not exists on the query calculated member - error */
)
}
dimension properties
[Account].[Accounts].[Account Type],
[Account].[Accounts].[Account Number],
[Account].[Accounts].[Accounts]
on rows
from
[Adventure Works]
|||Hi,
my question - how do I proper specify a mdx property in the query calculated member.
I do not want to catch errors - nor produce errors - howto specifiy the property value in the query.
The documentation at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2126305&SiteID=1 mentions a syntax, but I can not get it work.
If I properly read the doc I would write it like
Code Snippet
with
member [Account].[Accounts].[TEST] as 0 ([Account].[Accounts].[Account Type]="Assets")
/* create a new query calculated member in the hierarchy */
select
But it dos not work.
Any ideas howto write?
HANNES
|||Calculated members don't support custom member properties. The document you mentioned shows you how to use pre-defined member properties, such as FORMAT_STRING, for calculated members.Query Calculated Member - Member Properties
I have an urgent problem with some queries including calculated members where I want to filter by properties..
I have rewriten my query to show my issue on the Adventure Works Database.
Code Snippet
with
member [Account].[Accounts].[TEST] as 0
/* create a new query calculated member in the hierarchy */
select
{} on columns,
{
filter(
{
descendants([Account].[Accounts].&[1], 2)
,[Account].[Accounts].[TEST]
/* use the new calculated member */
/* comment out the calc member to see successfull execution */
},
[Account].[Accounts].CurrentMember.Properties("Account Type")="Assets"
/* filter by a member property which does not exists on the query calculated member - error */
)
}
dimension properties
[Account].[Accounts].[Account Type],
[Account].[Accounts].[Account Number],
[Account].[Accounts].[Accounts]
on rows
from
[Adventure Works]
I create a calcuated meber - and then I want to use this in a filter by member property. The Server always raises the error that the property does not exists.
How to solve this error?
The Documentation http://technet.microsoft.com/en-us/library/ms146017.aspx specify a possiblity to specify the property for the member - but I was not able to this - like documented It has no effect.
I need some urgent Help, HANNES
If you want filter to remove the calculated member then use stripcalculatedmembers function to remove all calculated members from the 1st argument. If you want filter to retain the calculated member then use the iserror function like below:
with
member [Account].[Accounts].[TEST] as 0
/* create a new query calculated member in the hierarchy */
select
{} on columns,
{
filter(
{
descendants([Account].[Accounts].&[1], 2)
,[Account].[Accounts].[TEST]
},
iserror([Account].[Accounts].CurrentMember.Properties("Account Type")) or [Account].[Accounts].CurrentMember.Properties("Account Type")="Assets"
/* filter by a member property which does not exists on the query calculated member - error */
)
}
dimension properties
[Account].[Accounts].[Account Type],
[Account].[Accounts].[Account Number],
[Account].[Accounts].[Accounts]
on rows
from
[Adventure Works]
|||Hi,
my question - how do I proper specify a mdx property in the query calculated member.
I do not want to catch errors - nor produce errors - howto specifiy the property value in the query.
The documentation at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2126305&SiteID=1 mentions a syntax, but I can not get it work.
If I properly read the doc I would write it like
Code Snippet
with
member [Account].[Accounts].[TEST] as 0 ([Account].[Accounts].[Account Type]="Assets")
/* create a new query calculated member in the hierarchy */
select
But it dos not work.
Any ideas howto write?
HANNES
|||Calculated members don't support custom member properties. The document you mentioned shows you how to use pre-defined member properties, such as FORMAT_STRING, for calculated members.