Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Monday, March 12, 2012

non_empty_behavior advice

Hello!

I'm new in the SSAS2005 world and was wondering if the following MDX script was good, especialy the non_empty_behavior part:

SCOPE ([ACCOUNTS].&[PU_MOI]);
This = Avg(
Descendants([ENTITIES].CurrentMember, , LEAVES) * Descendants([PRODUCTS].CurrentMember, , LEAVES)
);
Non_Empty_Behavior = [ACCOUNTS].&[PU_MOI];
END SCOPE;

As you can see, I want to display Averages for a special member of my ACCOUNTS dim and the same member is used in the non_empty_behavior property (if there is no data at an agregated level, there is not data on the leaves levels and so no need to calculate averages, at least I think so Wink. Is it right ?

I also tried to code this with the new EXISTING function but it doesn't seem to work
SCOPE ([ACCOUNTS].&[PU_MOI]);
This = Avg(
EXISTING Leaves([ENTITIES]) * EXISTING Leaves([PRODUCTS])
);
Non_Empty_Behavior = [ACCOUNTS].&[PU_MOI];
END SCOPE;

Should I use EXISTING that way ?

Thx!

Unless you plan to support scenarios where there is multiselect on Entities or Products - leave EXISTING out of it - the Descendants function will work just fine. If you do need to support multiselect, than you can use EXISTING, but please don't use Leaves() function in the right-hand side of assignment. You can replace it with the key level of appropriate dimension. It would also help if Entities and Products were not parent-child dimensions.

Use of Non_Empty_Behavior here is probably OK, but only if you don't have some other calculations (or even unary operators) which can interfere with how PU_MOI is computed.

|||

Thanks for your answer Mosha!

In fact, there may be a multi-select on Entities but the Average value wouldn't be of interest in that way so.. I also forgot to mention but Entities and Products are parent-child dims, so if I use the EXISTING formula, I have to use Leaves too, or it there another way ?

By the way, speaking of multi-selects, when retrieving coordinates of a cell from a MDX query result with a muti-select on Entities (from an MDX Query generated the old fashionned way, with an ugly Aggregate() function), how can I check that the Entity selected is not a real one but a calculation ? Maybe a Filter([Entities].Members) against the currently selected Entity ? Or is there a 'IsCalculatedMember' like function I could use ?

|||

The fact that Entities and Products are parent-child will cause issues, but you still don't need to use Leaves function. Descendants with LEAVES flag is good enough here. For more differences between the two, check out this blog: http://www.sqljunkies.com/WebLog/mosha/archive/2006/04/29/leaves.aspx

> By the way, speaking of multi-selects, when retrieving coordinates of a cell from a MDX query result with a muti-select on Entities (from an MDX Query generated the old fashionned way, with an ugly Aggregate() function), how can I check that the Entity selected is not a real one but a calculation ?

Sorry, but I didn't understand the question.

Friday, March 9, 2012

Non domain user receive access denied error

I am trying to run a VBScript that uses a SQL user to access a 2000 SQL SP4
clustered instance.
The script runs successfully only when I am logged on with a domain account.
What can the reason for this be?
Thanks in advance,
Ido Friedman
My first thought is that the VBScript is using NT authentication instead of
SQL Authentication.
Can you post the script?
Keith Kratochvil
"Ido friedman" <Idofriedman@.discussions.microsoft.com> wrote in message
news:A1B97509-42C7-4EBB-9BA3-786FA81E682F@.microsoft.com...
>I am trying to run a VBScript that uses a SQL user to access a 2000 SQL SP4
> clustered instance.
> The script runs successfully only when I am logged on with a domain
> account.
> What can the reason for this be?
>
> Thanks in advance,
> Ido Friedman

Saturday, February 25, 2012

nocheck when creating a constraint

i was looking at a database creation script and i have a bunch of
constraints being created with a nocheck on them. i think i know what
the nocheck does (don't check for data issues). i'm not sure why the
original coder would define them like this since there is no data to
begin with when the tables are built. am i missing something? does
this hurt the database table?
ALTER TABLE [dbo].[mytable] WITH NOCHECK ADD
CONSTRAINT [PK_mytable] PRIMARY KEY ([mytable_id]) ON [PRIMARY]That seems to be a stupid thing to do. You won't gain anything, and possibly just have a non-trusted
constraint which can lead to worse performance (non-trusted will limit some of the optimizations
that can be done).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Derek" <gepetto_2000@.yahoo.com> wrote in message
news:1178199834.825140.114810@.y5g2000hsa.googlegroups.com...
> i was looking at a database creation script and i have a bunch of
> constraints being created with a nocheck on them. i think i know what
> the nocheck does (don't check for data issues). i'm not sure why the
> original coder would define them like this since there is no data to
> begin with when the tables are built. am i missing something? does
> this hurt the database table?
>
> ALTER TABLE [dbo].[mytable] WITH NOCHECK ADD
> CONSTRAINT [PK_mytable] PRIMARY KEY ([mytable_id]) ON [PRIMARY]
>|||Derek,
See this blog from SQL Server MVP Hugo Kornelis.
Can you trust your constraints?
http://sqlblog.com/blogs/hugo_kornelis/archive/2007/03/29/can-you-trust-your-constraints.aspx
AMB
"Derek" wrote:
> i was looking at a database creation script and i have a bunch of
> constraints being created with a nocheck on them. i think i know what
> the nocheck does (don't check for data issues). i'm not sure why the
> original coder would define them like this since there is no data to
> begin with when the tables are built. am i missing something? does
> this hurt the database table?
>
> ALTER TABLE [dbo].[mytable] WITH NOCHECK ADD
> CONSTRAINT [PK_mytable] PRIMARY KEY ([mytable_id]) ON [PRIMARY]
>

nocheck when creating a constraint

i was looking at a database creation script and i have a bunch of
constraints being created with a nocheck on them. i think i know what
the nocheck does (don't check for data issues). i'm not sure why the
original coder would define them like this since there is no data to
begin with when the tables are built. am i missing something? does
this hurt the database table?
ALTER TABLE [dbo].[mytable] WITH NOCHECK ADD
CONSTRAINT [PK_mytable] PRIMARY KEY ([mytable_id]) ON [PRIMAR
Y]That seems to be a stupid thing to do. You won't gain anything, and possibly
just have a non-trusted
constraint which can lead to worse performance (non-trusted will limit some
of the optimizations
that can be done).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Derek" <gepetto_2000@.yahoo.com> wrote in message
news:1178199834.825140.114810@.y5g2000hsa.googlegroups.com...
> i was looking at a database creation script and i have a bunch of
> constraints being created with a nocheck on them. i think i know what
> the nocheck does (don't check for data issues). i'm not sure why the
> original coder would define them like this since there is no data to
> begin with when the tables are built. am i missing something? does
> this hurt the database table?
>
> ALTER TABLE [dbo].[mytable] WITH NOCHECK ADD
> CONSTRAINT [PK_mytable] PRIMARY KEY ([mytable_id]) ON [P
RIMARY]
>|||Derek,
See this blog from SQL Server MVP Hugo Kornelis.
Can you trust your constraints?
http://sqlblog.com/blogs/hugo_korne.../>
raints.aspx
AMB
"Derek" wrote:

> i was looking at a database creation script and i have a bunch of
> constraints being created with a nocheck on them. i think i know what
> the nocheck does (don't check for data issues). i'm not sure why the
> original coder would define them like this since there is no data to
> begin with when the tables are built. am i missing something? does
> this hurt the database table?
>
> ALTER TABLE [dbo].[mytable] WITH NOCHECK ADD
> CONSTRAINT [PK_mytable] PRIMARY KEY ([mytable_id]) ON [
PRIMARY]
>

Monday, February 20, 2012

No sqlclient database, how to run script to create?

After installed SQL Server 2005 with Management Studio, I found that there i
s
no any local server. So when the studio opened, no any server connection and
no any sqlclient database in local machine. May I run some script to create
the local server and sqlclient databse, if yes, where is the script, and how
to run? Else, have to re-install SQL Server 2005, and what install option is
missed?
Thanks.Hello,
Just go to SQL Server setup program and choose Database Services and
continue the install.
Before doing this go see the SQL server and see the DATA and LOG folder is
created. If yes open the latest Errorlog file from Log folder and
see Server name and try registering using that in management studio.
Thanks
Hari
"FD" <FD@.discussions.microsoft.com> wrote in message
news:421B3416-1AE9-4AFF-A853-6BCC8A04A797@.microsoft.com...
> After installed SQL Server 2005 with Management Studio, I found that there
> is
> no any local server. So when the studio opened, no any server connection
> and
> no any sqlclient database in local machine. May I run some script to
> create
> the local server and sqlclient databse, if yes, where is the script, and
> how
> to run? Else, have to re-install SQL Server 2005, and what install option
> is
> missed?
> Thanks.

No sqlclient database, how to run script to create?

After installed SQL Server 2005 with Management Studio, I found that there is
no any local server. So when the studio opened, no any server connection and
no any sqlclient database in local machine. May I run some script to create
the local server and sqlclient databse, if yes, where is the script, and how
to run? Else, have to re-install SQL Server 2005, and what install option is
missed?
Thanks.Hello,
Just go to SQL Server setup program and choose Database Services and
continue the install.
Before doing this go see the SQL server and see the DATA and LOG folder is
created. If yes open the latest Errorlog file from Log folder and
see Server name and try registering using that in management studio.
Thanks
Hari
"FD" <FD@.discussions.microsoft.com> wrote in message
news:421B3416-1AE9-4AFF-A853-6BCC8A04A797@.microsoft.com...
> After installed SQL Server 2005 with Management Studio, I found that there
> is
> no any local server. So when the studio opened, no any server connection
> and
> no any sqlclient database in local machine. May I run some script to
> create
> the local server and sqlclient databse, if yes, where is the script, and
> how
> to run? Else, have to re-install SQL Server 2005, and what install option
> is
> missed?
> Thanks.

No sqlclient database, how to run script to create?

After installed SQL Server 2005 with Management Studio, I found that there is
no any local server. So when the studio opened, no any server connection and
no any sqlclient database in local machine. May I run some script to create
the local server and sqlclient databse, if yes, where is the script, and how
to run? Else, have to re-install SQL Server 2005, and what install option is
missed?
Thanks.
Hello,
Just go to SQL Server setup program and choose Database Services and
continue the install.
Before doing this go see the SQL server and see the DATA and LOG folder is
created. If yes open the latest Errorlog file from Log folder and
see Server name and try registering using that in management studio.
Thanks
Hari
"FD" <FD@.discussions.microsoft.com> wrote in message
news:421B3416-1AE9-4AFF-A853-6BCC8A04A797@.microsoft.com...
> After installed SQL Server 2005 with Management Studio, I found that there
> is
> no any local server. So when the studio opened, no any server connection
> and
> no any sqlclient database in local machine. May I run some script to
> create
> the local server and sqlclient databse, if yes, where is the script, and
> how
> to run? Else, have to re-install SQL Server 2005, and what install option
> is
> missed?
> Thanks.