Showing posts with label integer. Show all posts
Showing posts with label integer. Show all posts

Wednesday, March 7, 2012

Maximum allowed value for integer in Analysis Services

Is there a maximum number up to which Analysis Services will do a SUM up to.

The reason I ask is that I get a negative number when I run the following MDX ([Mesaure] is aggregated with SUM)

SELECT [Measures].[Measure] ON AXIS(0)
FROM [Cube]

However each row in my fact table has a positive (and quite large value) for its Measure.

Thanks in advance

Stephen

Yes. There a maximun value of integer, I believe its just over 2 billion or so. When you first built your cube, AS defaulted your measure to the datatype in your source. You will have to change the datatype to a bigint, then you won't see those negative values.

Van Dieu

|||Sweet. Bigint it is. Don't know why it never occured to me to change the datatype of the Measure in Analysis Services.

Oh well, the simple things.

Monday, February 20, 2012

Max() across 2 tables in one query?

I have two tables (T1 and T2) in SQL 2000 DB, each with an Integer column "I
D".
I want to get the Max(ID) across both tables. I know I could declare
variable(s) and execute separate query for each table, but I would prefer to
keep it to one, simple query.
I tried: select Max(ID) from (select Max(ID) from T1 union select Max(ID)
from T2)
but that doesn't execute.You were close:
select Max(ID) from
(select Max(ID) from T1
union ALL
select Max(ID) from T2) as X
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
"lmcphee" <lmcphee@.discussions.microsoft.com> wrote in message
news:4D0B0A20-1076-440E-9429-A8EEC1BA0851@.microsoft.com...
I have two tables (T1 and T2) in SQL 2000 DB, each with an Integer column
"ID".
I want to get the Max(ID) across both tables. I know I could declare
variable(s) and execute separate query for each table, but I would prefer to
keep it to one, simple query.
I tried: select Max(ID) from (select Max(ID) from T1 union select Max(ID)
from T2)
but that doesn't execute.|||select Max(ID) from (select Max(ID) id from T1 union all select Max(ID)
id from T2) t|||Use Pubs
Select (Select Max(Au_ID) From Authors) As 'MaxAuthorsID',
(Select Max(Emp_ID) From Employee) As 'MaxEmployeeID'
HTH
Barry|||Oops! Mis-read the post - I apologise!
It is Friday after all... ;-)
Barry|||Tom,
I guess this too will give an error...
May be it should be
select Max(ID) from
(select Max(ID) as ID from T1
union ALL
select Max(ID) from T2) as X
"Tom Moreau" wrote:

> You were close:
> select Max(ID) from
> (select Max(ID) from T1
> union ALL
> select Max(ID) from T2) as X
>
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> "lmcphee" <lmcphee@.discussions.microsoft.com> wrote in message
> news:4D0B0A20-1076-440E-9429-A8EEC1BA0851@.microsoft.com...
> I have two tables (T1 and T2) in SQL 2000 DB, each with an Integer column
> "ID".
> I want to get the Max(ID) across both tables. I know I could declare
> variable(s) and execute separate query for each table, but I would prefer
to
> keep it to one, simple query.
> I tried: select Max(ID) from (select Max(ID) from T1 union select Max(ID)
> from T2)
> but that doesn't execute.
>
>|||Good catch.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
"Omnibuzz" <Omnibuzz@.discussions.microsoft.com> wrote in message
news:C73B532C-9096-4438-8FC1-44AE770861B6@.microsoft.com...
Tom,
I guess this too will give an error...
May be it should be
select Max(ID) from
(select Max(ID) as ID from T1
union ALL
select Max(ID) from T2) as X
"Tom Moreau" wrote:

> You were close:
> select Max(ID) from
> (select Max(ID) from T1
> union ALL
> select Max(ID) from T2) as X
>
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> "lmcphee" <lmcphee@.discussions.microsoft.com> wrote in message
> news:4D0B0A20-1076-440E-9429-A8EEC1BA0851@.microsoft.com...
> I have two tables (T1 and T2) in SQL 2000 DB, each with an Integer column
> "ID".
> I want to get the Max(ID) across both tables. I know I could declare
> variable(s) and execute separate query for each table, but I would prefer
> to
> keep it to one, simple query.
> I tried: select Max(ID) from (select Max(ID) from T1 union select Max(ID)
> from T2)
> but that doesn't execute.
>
>