Showing posts with label rows. Show all posts
Showing posts with label rows. Show all posts

Friday, March 23, 2012

Link display in a report

How do I setup a link to only display when data is in the report I’m jumping to.

I don’t want to display the link if I don’t have any rows in the report.

You would probably have to set this up outside of the Report Manager portal, using a custom interface.

You may be able to get away with running a custom script that would query for the existence of data, and toggle security for individual reports that have no data.

This scripting tool may help with this task.

http://www.sqldbatips.com/showarticle.asp?ID=62

cheers,

Andrew

Monday, March 19, 2012

Limits on rows in a table

Hi

We received the following in an email from a third-party supplier (who
naturally has a solution for the problem as described). It sounds like
gibberish to me, but does anyone have any comments?

<quote>
SQL in its current incarnation hits a performance brick wall when a
table contains more than about 75 million rows. This is not a
configuration limit as the table could be grown a lot larger but the
performance issue generates problems for ??; primarily during
search and retrieval of archived objects; although if the database
engine is being heavily hit for retrieval the archiving process can
slow down as well.
</quote
Chloe Crowder
British Librarychloe.crowder@.bl.uk wrote:
> Hi
> We received the following in an email from a third-party supplier (who
> naturally has a solution for the problem as described). It sounds like
> gibberish to me, but does anyone have any comments?
> <quote>
> SQL in its current incarnation hits a performance brick wall when a
> table contains more than about 75 million rows. This is not a
> configuration limit as the table could be grown a lot larger but the
> performance issue generates problems for ??; primarily during
> search and retrieval of archived objects; although if the database
> engine is being heavily hit for retrieval the archiving process can
> slow down as well.
> </quote
I've never heard something like this before. Maybe it's a problem
limited to a specific application. Maybe the app uses the DB in bad
ways (wrong indexing...)?

robert|||chloe.crowder@.bl.uk wrote:
> Hi
> We received the following in an email from a third-party supplier (who
> naturally has a solution for the problem as described). It sounds like
> gibberish to me, but does anyone have any comments?
> <quote>
> SQL in its current incarnation hits a performance brick wall when a
> table contains more than about 75 million rows. This is not a
> configuration limit as the table could be grown a lot larger but the
> performance issue generates problems for ??; primarily during
> search and retrieval of archived objects; although if the database
> engine is being heavily hit for retrieval the archiving process can
> slow down as well.
> </quote>
> Chloe Crowder
> British Library

"SQL in its current incarnation..."

SQL is a language and it has no such limitations. Did they mean to
refer to Microsoft SQL Server? Either way, their claim is plain
nonsense.

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/...US,SQL.90).aspx
--|||(chloe.crowder@.bl.uk) writes:
> We received the following in an email from a third-party supplier (who
> naturally has a solution for the problem as described). It sounds like
> gibberish to me, but does anyone have any comments?
><quote>
> SQL in its current incarnation hits a performance brick wall when a
> table contains more than about 75 million rows. This is not a
> configuration limit as the table could be grown a lot larger but the
> performance issue generates problems for ??; primarily during
> search and retrieval of archived objects; although if the database
> engine is being heavily hit for retrieval the archiving process can
> slow down as well.
></quote
SQL [Server] in its current incarnation? Nah, rather the current
incarnation of the application from the supplier hits a brick wall, and
the supplier needs to clean up its act.

OK, a 75-million is no game for kids, and it requires more careful coding
and design than a 750000 row table.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Erland is correct; I personally am running an app that generates
40,000,000 rows of data a day, and it performs well (and it's not a
super server, either). I also suck data out of app by a vendor that
has less than 100,000 rows per day, and it takes hours using their
method.

Not saying you should point the finger at your vendor, but if the
performance of their app is mission-critical, and they value your
business, you need to have a conversation with them about SQL tuning.
Could be something you're doing, or it could be something they're
doing. But it's probably not the engine (unless you're running SQL
Server on a bare-bones server).

Stu|||chloe.crowder@.bl.uk wrote:
> Hi
> We received the following in an email from a third-party supplier (who
> naturally has a solution for the problem as described). It sounds like
> gibberish to me, but does anyone have any comments?
> <quote>
> SQL in its current incarnation hits a performance brick wall when a
> table contains more than about 75 million rows. This is not a
> configuration limit as the table could be grown a lot larger but the
> performance issue generates problems for ??; primarily during
> search and retrieval of archived objects; although if the database
> engine is being heavily hit for retrieval the archiving process can
> slow down as well.
> </quote
Translation 1:

We charge little money for our services, and we need to have profits so
we contract amateurs to do the job and when there are problems we
complain against something/someone not related to us. If you want a
solution pay us more money.

Translation 2:

We didn't think about a table with 75 million rows, we don't want to
look like stupids and lose you as a customer.

etc, etc...

One thing is sure, your supplier is not honest, don't trust them!

> Chloe Crowder
> British Library|||Thanks everyone - I was 99.9% sure it was rubbish and the problem was
with their app, but I thought I should check.

Chloe

Monday, March 12, 2012

Limiting the Number of rows displayed per table.

Dear Report Pros,

I am New to the world of report viewer.

Problem : I have placed 3 tables on top of each other on the rdlc document, done the binding to my business Objects every thing is ok EXCEPT THAT:

the number of rows displyed by the top table are big to the point that the table would stretch Vertically (grow) to accomodate them and It would cover the other 2 tables under it , so basically the first table gets expanded so much to the point that it consumes the rest of the page and hiding / moving the other 2 tables.

I NEED a WAY to LIMIT the number of rows to be displayed per each table regardless of the resultset size, for example I just need to display the first 4 rows of the result comming to this table which might contain 20 rows, and I am hoping that there is a Scrolling / Next mechanizm that that if the user is interested to review the rest of the resltset in this particular table he can.

I understand that this can be achieved through the use of Grups and expressions, but I am not sure how to do this exactly what and where to I place my expression on the table.

Thanks very much in advance for your time and help.

HI,

I suppose you need a custom page break in this scenario. You can have a look at "Page Break " section in the following article:

http://msdn2.microsoft.com/en-us/library/ms251668(VS.80).aspx

|||

HI,

We are marking this issue as "Answered". If you have any new findings or concerns, please feel free to unmark the issue.
Thank you for your understanding!

limiting the number of child rows

Hi

I have got two related tables (tblMembers and tblTickets) that have a 1 to 2 relationship i.e a member can have 1 or 2 tickets, but not more.

How do I enforce this condition in SQL?.

Please help

Hello,

There are several ways to implement this. I assume you have a table similar to tblMemberTicket in which you have a 1-n from tblMemebers and a 1-n from tblTickets...

1. Triggers

2. Check constraints

3. Application login in stored procedures.

If you need enforcement at the schema level, then only options 1 or 2 are applicable.

Cheers,

Rob

|||

Thanks Rob, I've solved it with a check constraint.

(Isn't that triggers are executed after the INSERT?..... i'm a newbie)

|||

Hi GM,

An INSTEAD OF INSERT trigger for example, fires when any action attempts an insert - not "after" the data has been inserted (so to speak).

Cheers,

Rob

|||

How did you do this with a check constraint? The only way I can think is to it in a check constraint is to have a domain of two value:

columnName tinyint check (column between 1 and 2)

would do it, but it would seem clumsy to work with.

You couldn't really do it in a check constraint that uses a user-defined function easily since the value isn't in the table yet, you would have to see if two already exist.

Best to use an AFTER trigger for that. Basically you check once the data in in the table (inside your transaction of course) to see if an invalid situation exists. Then you rollback as needed:

create table cardinalityTest
(
cardinalityTest int identity(1,1),
groupColumn char(10),
value int
) --I would expect a natural key to be available in a real table
go

create trigger cardinalityTest$insertTrigger
on cardinalityTest
after insert, update
as
begin
begin try
if exists (select groupColumn
from cardinalityTest
--only check groupColumn values that have changed
where exists ( select *
from inserted
where inserted.groupColumn = cardinalityTest.groupColumn)
group by groupColumn
having count(*) > 2 --two is allowed
)
raiserror ('Greater than 2 values for a groupColumn value',16,1)
end try
begin catch
if @.@.trancount > 1
rollback transaction

--you can do something more interesting
declare @.message varchar(4000)
set @.message = error_message()
raiserror (@.message, 16, 1)

end catch
end
go
insert into cardinalityTest(groupColumn, value)
select 'first',1

insert into cardinalityTest(groupColumn, value)
select 'first',1

insert into cardinalityTest(groupColumn, value)
select 'first',2

Msg 50000, Level 16, State 1, Procedure cardinalityTest$insertTrigger, Line 26
Greater than 2 values for a groupColumn value
Msg 3616, Level 16, State 1, Line 1
Transaction doomed in trigger. Batch has been aborted.

insert into cardinalityTest(groupColumn, value)
select 'second',1
union all
select 'second',1

insert into cardinalityTest(groupColumn, value)
select 'nope',1
union all
select 'nope',1
union all
select 'nope',1

Msg 50000, Level 16, State 1, Procedure cardinalityTest$insertTrigger, Line 26
Greater than 2 values for a groupColumn value
Msg 3616, Level 16, State 1, Line 1
Transaction doomed in trigger. Batch has been aborted.


insert into cardinalityTest(groupColumn, value)
select 'third',1
union all
select 'third',1
union all
select 'fourth',1
union all
select 'fourth',1

insert into cardinalityTest(groupColumn, value)
select 'fifth',1
union all
select 'fifth',1
union all
select 'fifth',1
union all
select 'sixth',1

Msg 50000, Level 16, State 1, Procedure cardinalityTest$insertTrigger, Line 26
Greater than 2 values for a groupColumn value
Msg 3616, Level 16, State 1, Line 1
Transaction doomed in trigger. Batch has been aborted.

|||

CHECK constraints are evaluated at the end of the DML action so you could use a UDF like:

create function CT2 ()
returns bit
as
begin
return(select top 1 1 from CardinalityTest group by groupColumn having count(*) > 2)
end

go

-- Table-level CHECK constraint

alter table CardinalityTest
add check ( dbo.CT2() is null )

go

|||

Wow. I sure had that wrong. I was thinking that checks happened before the data was in the table.

Thanks for the info.

|||

Hi

Does this apply to SQL Server 2000 too ?

Because right now, I'm experiencing quite different behavior....

I have temporal table where each row hase ActiveFrom, ActiveTo column.

There is "primary key", but there can be more than one row with same primary key value as long as rows has different, not overlaping time interval specified by ActiveFrom and ActiveTo columns...

There is no way to create real primary key here so i'm trying to create table level constraint using UDF which checks this.....

My function:

create function TestFinancialIndicatorBusinessKey()

returns int

as

begin

declare @.retVal int

SELECT @.retVal = ISNULL(COUNT(*), 0)

FROM FinancialIndicator AS A

INNER JOIN FinancialIndicator AS B

ON (A.Id != B.Id) AND (A.IdFSFormat = B.IdFSFormat) AND (A.IdFIType = B.IdFIType) AND (A.MainSegment = B.MainSegment)

WHERE dbo.IsIntervalIntersectionNonEmpty(A.ActiveFrom, A.ActiveTo, B.ActiveFrom, B.ActiveTo) > 0

PRINT ISNULL(@.retVal, 0)

return @.retVal

end

GO

(Id is syntetic primary key - identity, (IdFSFormat,IdFIType, MainSegment) is "primary key"

I've created constraint like this:

ALTER TABLE dbo.FinancialIndicator

WITH CHECK ADD CONSTRAINT CHK_BUSINESS_KEY

CHECK (dbo.TestFinancialIndicatorBusinessKey() = 0);

Everything seems fine, but doesn't work ! Firts update to table, which break this rule is executed without problem. Next update which should repair the incorect row fails....

It seems like this table level constraint is executed only before my update....

Any idea

Thanx, Michal

limiting the number of child rows

Hi

I have got two related tables (tblMembers and tblTickets) that have a 1 to 2 relationship i.e a member can have 1 or 2 tickets, but not more.

How do I enforce this condition in SQL?.

Please help

Hello,

There are several ways to implement this. I assume you have a table similar to tblMemberTicket in which you have a 1-n from tblMemebers and a 1-n from tblTickets...

1. Triggers

2. Check constraints

3. Application login in stored procedures.

If you need enforcement at the schema level, then only options 1 or 2 are applicable.

Cheers,

Rob

|||

Thanks Rob, I've solved it with a check constraint.

(Isn't that triggers are executed after the INSERT?..... i'm a newbie)

|||

Hi GM,

An INSTEAD OF INSERT trigger for example, fires when any action attempts an insert - not "after" the data has been inserted (so to speak).

Cheers,

Rob

|||

How did you do this with a check constraint? The only way I can think is to it in a check constraint is to have a domain of two value:

columnName tinyint check (column between 1 and 2)

would do it, but it would seem clumsy to work with.

You couldn't really do it in a check constraint that uses a user-defined function easily since the value isn't in the table yet, you would have to see if two already exist.

Best to use an AFTER trigger for that. Basically you check once the data in in the table (inside your transaction of course) to see if an invalid situation exists. Then you rollback as needed:

create table cardinalityTest
(
cardinalityTest int identity(1,1),
groupColumn char(10),
value int
) --I would expect a natural key to be available in a real table
go

create trigger cardinalityTest$insertTrigger
on cardinalityTest
after insert, update
as
begin
begin try
if exists (select groupColumn
from cardinalityTest
--only check groupColumn values that have changed
where exists ( select *
from inserted
where inserted.groupColumn = cardinalityTest.groupColumn)
group by groupColumn
having count(*) > 2 --two is allowed
)
raiserror ('Greater than 2 values for a groupColumn value',16,1)
end try
begin catch
if @.@.trancount > 1
rollback transaction

--you can do something more interesting
declare @.message varchar(4000)
set @.message = error_message()
raiserror (@.message, 16, 1)

end catch
end
go
insert into cardinalityTest(groupColumn, value)
select 'first',1

insert into cardinalityTest(groupColumn, value)
select 'first',1

insert into cardinalityTest(groupColumn, value)
select 'first',2

Msg 50000, Level 16, State 1, Procedure cardinalityTest$insertTrigger, Line 26
Greater than 2 values for a groupColumn value
Msg 3616, Level 16, State 1, Line 1
Transaction doomed in trigger. Batch has been aborted.

insert into cardinalityTest(groupColumn, value)
select 'second',1
union all
select 'second',1

insert into cardinalityTest(groupColumn, value)
select 'nope',1
union all
select 'nope',1
union all
select 'nope',1

Msg 50000, Level 16, State 1, Procedure cardinalityTest$insertTrigger, Line 26
Greater than 2 values for a groupColumn value
Msg 3616, Level 16, State 1, Line 1
Transaction doomed in trigger. Batch has been aborted.


insert into cardinalityTest(groupColumn, value)
select 'third',1
union all
select 'third',1
union all
select 'fourth',1
union all
select 'fourth',1

insert into cardinalityTest(groupColumn, value)
select 'fifth',1
union all
select 'fifth',1
union all
select 'fifth',1
union all
select 'sixth',1

Msg 50000, Level 16, State 1, Procedure cardinalityTest$insertTrigger, Line 26
Greater than 2 values for a groupColumn value
Msg 3616, Level 16, State 1, Line 1
Transaction doomed in trigger. Batch has been aborted.

|||

CHECK constraints are evaluated at the end of the DML action so you could use a UDF like:

create function CT2 ()
returns bit
as
begin
return(select top 1 1 from CardinalityTest group by groupColumn having count(*) > 2)
end

go

-- Table-level CHECK constraint

alter table CardinalityTest
add check ( dbo.CT2() is null )

go

|||

Wow. I sure had that wrong. I was thinking that checks happened before the data was in the table.

Thanks for the info.

|||

Hi

Does this apply to SQL Server 2000 too ?

Because right now, I'm experiencing quite different behavior....

I have temporal table where each row hase ActiveFrom, ActiveTo column.

There is "primary key", but there can be more than one row with same primary key value as long as rows has different, not overlaping time interval specified by ActiveFrom and ActiveTo columns...

There is no way to create real primary key here so i'm trying to create table level constraint using UDF which checks this.....

My function:

create function TestFinancialIndicatorBusinessKey()

returns int

as

begin

declare @.retVal int

SELECT @.retVal = ISNULL(COUNT(*), 0)

FROM FinancialIndicator AS A

INNER JOIN FinancialIndicator AS B

ON (A.Id != B.Id) AND (A.IdFSFormat = B.IdFSFormat) AND (A.IdFIType = B.IdFIType) AND (A.MainSegment = B.MainSegment)

WHERE dbo.IsIntervalIntersectionNonEmpty(A.ActiveFrom, A.ActiveTo, B.ActiveFrom, B.ActiveTo) > 0

PRINT ISNULL(@.retVal, 0)

return @.retVal

end

GO

(Id is syntetic primary key - identity, (IdFSFormat,IdFIType, MainSegment) is "primary key"

I've created constraint like this:

ALTER TABLE dbo.FinancialIndicator

WITH CHECK ADD CONSTRAINT CHK_BUSINESS_KEY

CHECK (dbo.TestFinancialIndicatorBusinessKey() = 0);

Everything seems fine, but doesn't work ! Firts update to table, which break this rule is executed without problem. Next update which should repair the incorect row fails....

It seems like this table level constraint is executed only before my update....

Any idea

Thanx, Michal

Limiting the amount of rows

I want to list a particular attribute value and the number of times it occurs
in the database ie
Attribute value 1 6
Attribute value 2 5
Attribute value 3 5
Attribute value 4 4
Attribute value 5 4
Attribute value 6 3
Attribute value 7 3
Attribute value 8 3
Attribute value 9 3
Attribute value 10 2
Attribute value 11 2
Attribute value 12 1
Attribute value 13 1
However I want the result set to list the top 10 records. This could be
done using the top 10 function. However as you can see Attribute value
10 and 11 both have the total of 2 and are therefore equilvalent. So I
really want the top 11 returned in this case. If Attribute value 12
had been 2 then I would have wanted the top 12 etc
How can I do this?
MTKIRWAN wrote:
> I want to list a particular attribute value and the number of times
> it occurs in the database ie
> Attribute value 1 6
> Attribute value 2 5
> Attribute value 3 5
> Attribute value 4 4
> Attribute value 5 4
> Attribute value 6 3
> Attribute value 7 3
> Attribute value 8 3
> Attribute value 9 3
> Attribute value 10 2
> Attribute value 11 2
> Attribute value 12 1
> Attribute value 13 1
> However I want the result set to list the top 10 records. This could
> be done using the top 10 function. However as you can see Attribute
> value 10 and 11 both have the total of 2 and are therefore
> equilvalent. So I really want the top 11 returned in this case. If
> Attribute value 12
> had been 2 then I would have wanted the top 12 etc
> How can I do this?
Try something like this:
In this example, I'm looking for the TOP 4. There are 6 groups. If you
run a GROUP BY with COUNT in DESC order on the COUNT, you'll see we have
a matching count on 4 and 5, so what we really want is the first five
groups.
What I did was use an IN query to pull in just the raw totals for the
highest 4 rows and then use those results in the HAVING clause. The main
query does not use a TOP clause because we are limited by the HAVING.
create table #test (Attr varchar(10))
insert into #test values ('Attr1')
insert into #test values ('Attr1')
insert into #test values ('Attr1')
insert into #test values ('Attr1')
insert into #test values ('Attr1')
insert into #test values ('Attr2')
insert into #test values ('Attr2')
insert into #test values ('Attr2')
insert into #test values ('Attr3')
insert into #test values ('Attr3')
insert into #test values ('Attr3')
insert into #test values ('Attr4')
insert into #test values ('Attr4')
insert into #test values ('Attr5')
insert into #test values ('Attr5')
select Attr, COUNT(*) as 'Count'
from #test
Group By Attr
Having COUNT(*) IN (
select TOP 4 COUNT(*) as 'Count'
from #test
Group By Attr
Order By 1 Desc)
Order By 2 Desc
David Gugick
Imceda Software
www.imceda.com
|||On Wed, 22 Sep 2004 18:59:03 -0700, MTKIRWAN wrote:

> However I want the result set to list the top 10 records. This could be
> done using the top 10 function. However as you can see Attribute value
>10 and 11 both have the total of 2 and are therefore equilvalent. So I
> really want the top 11 returned in this case. If Attribute value 12
>had been 2 then I would have wanted the top 12 etc
> How can I do this?
TOP 10 WITH TIES
?
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Hugo Kornelis wrote:
> On Wed, 22 Sep 2004 18:59:03 -0700, MTKIRWAN wrote:
>
> TOP 10 WITH TIES
> ?
> Best, Hugo
I guess you learn something every day. Never knew.
David Gugick
Imceda Software
www.imceda.com

Limiting the amount of rows

I want to list a particular attribute value and the number of times it occurs
in the database ie
Attribute value 1 6
Attribute value 2 5
Attribute value 3 5
Attribute value 4 4
Attribute value 5 4
Attribute value 6 3
Attribute value 7 3
Attribute value 8 3
Attribute value 9 3
Attribute value 10 2
Attribute value 11 2
Attribute value 12 1
Attribute value 13 1
However I want the result set to list the top 10 records. This could be
done using the top 10 function. However as you can see Attribute value
10 and 11 both have the total of 2 and are therefore equilvalent. So I
really want the top 11 returned in this case. If Attribute value 12
had been 2 then I would have wanted the top 12 etc
How can I do this?MTKIRWAN wrote:
> I want to list a particular attribute value and the number of times
> it occurs in the database ie
> Attribute value 1 6
> Attribute value 2 5
> Attribute value 3 5
> Attribute value 4 4
> Attribute value 5 4
> Attribute value 6 3
> Attribute value 7 3
> Attribute value 8 3
> Attribute value 9 3
> Attribute value 10 2
> Attribute value 11 2
> Attribute value 12 1
> Attribute value 13 1
> However I want the result set to list the top 10 records. This could
> be done using the top 10 function. However as you can see Attribute
> value 10 and 11 both have the total of 2 and are therefore
> equilvalent. So I really want the top 11 returned in this case. If
> Attribute value 12
> had been 2 then I would have wanted the top 12 etc
> How can I do this?
Try something like this:
In this example, I'm looking for the TOP 4. There are 6 groups. If you
run a GROUP BY with COUNT in DESC order on the COUNT, you'll see we have
a matching count on 4 and 5, so what we really want is the first five
groups.
What I did was use an IN query to pull in just the raw totals for the
highest 4 rows and then use those results in the HAVING clause. The main
query does not use a TOP clause because we are limited by the HAVING.
create table #test (Attr varchar(10))
insert into #test values ('Attr1')
insert into #test values ('Attr1')
insert into #test values ('Attr1')
insert into #test values ('Attr1')
insert into #test values ('Attr1')
insert into #test values ('Attr2')
insert into #test values ('Attr2')
insert into #test values ('Attr2')
insert into #test values ('Attr3')
insert into #test values ('Attr3')
insert into #test values ('Attr3')
insert into #test values ('Attr4')
insert into #test values ('Attr4')
insert into #test values ('Attr5')
insert into #test values ('Attr5')
select Attr, COUNT(*) as 'Count'
from #test
Group By Attr
Having COUNT(*) IN (
select TOP 4 COUNT(*) as 'Count'
from #test
Group By Attr
Order By 1 Desc)
Order By 2 Desc
David Gugick
Imceda Software
www.imceda.com|||On Wed, 22 Sep 2004 18:59:03 -0700, MTKIRWAN wrote:
> However I want the result set to list the top 10 records. This could be
> done using the top 10 function. However as you can see Attribute value
>10 and 11 both have the total of 2 and are therefore equilvalent. So I
> really want the top 11 returned in this case. If Attribute value 12
>had been 2 then I would have wanted the top 12 etc
> How can I do this?
TOP 10 WITH TIES
?
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Hugo Kornelis wrote:
> On Wed, 22 Sep 2004 18:59:03 -0700, MTKIRWAN wrote:
>> However I want the result set to list the top 10 records. This could
>> be done using the top 10 function. However as you can see Attribute
>> value 10 and 11 both have the total of 2 and are therefore
>> equilvalent. So I really want the top 11 returned in this case. If
>> Attribute value 12 had been 2 then I would have wanted the top 12 etc
>> How can I do this?
> TOP 10 WITH TIES
> ?
> Best, Hugo
I guess you learn something every day. Never knew.
--
David Gugick
Imceda Software
www.imceda.com

Limiting Rows in a Report

I am having a table with 100 rows and i want to prepare a report in a
way that each page in the report want to display 10 rows in a page of
the report please say me the procedur for this .
thanks,
baba.If you have SQL 2K5, use ROW_NUMBER. If you're using SQL 2000, do a
self-join on the table. Here's a sample that runs on the Northwind DB:
SELECT COUNT(*) AS RowNumber, c.CustomerID, c.CompanyName, c.ContactName
FROM Customers c, Customers d
WHERE d.CustomerID <= c.CustomerID
GROUP BY c.CustomerID, c.CompanyName, c.ContactName
ORDER BY c.CustomerID
If you put this in a VIEW you can select where RowNumber between 1 and 10 to
grab the first ten; then RowNumber between 11 and 20 to grab the next 10,
etc.
"lucky" <j.v.s.s.baba@.gmail.com> wrote in message
news:1148564830.990338.67400@.j73g2000cwa.googlegroups.com...
>I am having a table with 100 rows and i want to prepare a report in a
> way that each page in the report want to display 10 rows in a page of
> the report please say me the procedur for this .
> thanks,
> baba.
>|||http://www.aspfaq.com/show.asp?id=2120
http://www.aspfaq.com/show.asp?id=2120
"lucky" <j.v.s.s.baba@.gmail.com> wrote in message
news:1148564830.990338.67400@.j73g2000cwa.googlegroups.com...
>I am having a table with 100 rows and i want to prepare a report in a
> way that each page in the report want to display 10 rows in a page of
> the report please say me the procedur for this .
> thanks,
> baba.
>

Limiting Rows in a Report

Hello,
i am in a problem that i am having a table with 100 rows while i am
presenting in report i want to limit rows to be 10 in a page in the
report like that i want to get 10 pages .Please say me the procedure
for this.
Thanks,
Baba.lucky (j.v.s.s.baba@.gmail.com) writes:
> i am in a problem that i am having a table with 100 rows while i am
> presenting in report i want to limit rows to be 10 in a page in the
> report like that i want to get 10 pages .Please say me the procedure
> for this.

I would suggest that you are better off asking this in a forum for the
report tool you are using. Surely you do not intend to requery the
database foe each page? Surely the report tool must permit you to define
a page size?

If the reporting tool is Reporting Services, tryu
microsoft.public.sqlserver.reportingsvcs.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Limiting Results from MDX query

Is there any way to specify that I only
want the last 16 rows of an MDX query?

Thanks.

Depends on the query, and depends what exactly you want to limit. In the simplest case when there are no NON EMPTY clauses, you can modify the select statement from

SELECT set0 on COLUMNS, set1 on ROWS FROM cube

to

SELECT set0 on COLUMNS, Head(set1, 16) on ROWS FROM cube

|||

What I actually need is to have my results
only return values that fall within a certain
date range.

It's kinda complicated.

First I need a cumulative running total of
hours charged, then after that I need only
the last 16 weeks of data. I was thinking
of something like this, but it's not working.

WITH MEMBER [Measures].[CumulativeTimeCharged] AS

'SUM({NULL:[Date].[Week].CurrentMember},[Time Charged])'

SET [SixteenWeeks] AS

'Filter( [Date].[Day].Members,

[Date].[Day] >= STRTOMEMBER(@.graphStartDate, CONSTRAINED) AND

[Date].[Day] <= STRTOMEMBER(@.ToDate, CONSTRAINED))'

SELECT NON EMPTY

{

[Measures].[CumulativeTimeCharged]

} ON COLUMNS,

NON EMPTY

{

(

[Project].[Project Number].[Project Number].ALLMEMBERS *

[SixteenWeeks]

)

} ON ROWS

FROM

(

SELECT

(

Null:STRTOMEMBER(@.ToDate, CONSTRAINED)

) ON COLUMNS

FROM

(

SELECT

(

STRTOSET(@.Project, CONSTRAINED)

) ON COLUMNS

FROM [Timesheet_Cube]

)

)

Any suggestions?|||

Let me explain a little more.
Using the following query:

WITH MEMBER [Measures].[CumulativeTimeCharged] AS 

'SUM({NULL:[Header].[Week Ending].CurrentMember},[Time Charged])'

SELECT NON EMPTY

{

[Measures].[CumulativeTimeCharged]

} ON COLUMNS,

NON EMPTY

{

(

[Project].[Project Number].[Project Number].ALLMEMBERS *

[Header].[Week Ending].[Week Ending].ALLMEMBERS

)

} ON ROWS

FROM

(

SELECT

(

STRTOSET(@.Project, CONSTRAINED)

) ON COLUMNS

FROM [Timesheet_Cube]

)

I get the results on the screenshot at the following link:

http://picasaweb.google.com/fbalas/ScreenShots/photo#5000287345760862226

As you can see from the above results, I am getting
results from weeks before my desired range and results
after my desired range (which also are pretty useless
because there was no additional time after the cutoff so
the cumulative number is always the same).

Is my problem understandable the way I've presented it?

|||Sorry - I have hard time understanding your requirements. Do you want the running sum to run only from 16 weeks back, or do you want it to run from the beginning, but restrict to the subset of Weeks Ending in the report ?|||

Re Mosha:

Thanks for the reply.
What I'm looking for is more like using Tail() than head.
But if you look in the rest of the thread, my problem now
also includes filtering out records at the end as well.

|||

The second understanding is correct...

I want the cumulative sum to run from the beginning of
time, but I only want the last 16 weeks from the cutoff
time (which will be specified by the user using SSRS).

I will be graphing this data, that's why the user wants
to restrict it to only 16 weeks, so that they can see
the dates on the X-axis. If I were to include all the data,
the dates on the X-axis begin to get to small to read.

|||

I should also mention that I am a relative beginner
with this MDX stuff so if what I am asking is so blatantly
easy that you can't fathom why I didn't try something
completely different... please forgive me ;-)

|||

OK - if you need to get 16 weeks from the current week - you can use

StrToMember(@.CurrentWeek, CONSTRAINED) : StrToMember(@.CurrentWeek, CONSTRAINED).Lead(16)

If you need 16 weeks before the current week - you can use

StrToMember(@.CurrentWeek, CONSTRAINED).Lag(16) : StrToMember(@.CurrentWeek, CONSTRAINED)

HTH

Mosha

|||

Thank you so much Mosha! You just saved me
hours of frustration. I have 3 books now that I will
be going over to hopefully edumacate me on this topic ;-)

For those interested my final solution looked like:

WITH MEMBER [Measures].[CumulativeTimeCharged] AS

'SUM({NULL:[Header].[Week Ending].CurrentMember},[Time Charged])'

SELECT NON EMPTY

{

[Measures].[CumulativeTimeCharged]

} ON COLUMNS,

NON EMPTY

{

(

[Project].[Project Number].[Project Number].ALLMEMBERS *

{

StrToMember(@.ToDate, CONSTRAINED).Lag(15) : StrToMember(@.ToDate, CONSTRAINED)

}

)

} ON ROWS

FROM

(

SELECT

(

STRTOSET(@.Project, CONSTRAINED)

) ON COLUMNS

FROM [Timesheet_Cube]

)

|||

I have 3 books now

Is one of those books mine ? (Fast Track to MDX)

|||Actually yes, one of them is ;-)

Limiting Results from MDX query

Is there any way to specify that I only
want the last 16 rows of an MDX query?

Thanks.

Depends on the query, and depends what exactly you want to limit. In the simplest case when there are no NON EMPTY clauses, you can modify the select statement from

SELECT set0 on COLUMNS, set1 on ROWS FROM cube

to

SELECT set0 on COLUMNS, Head(set1, 16) on ROWS FROM cube

|||

What I actually need is to have my results
only return values that fall within a certain
date range.

It's kinda complicated.

First I need a cumulative running total of
hours charged, then after that I need only
the last 16 weeks of data. I was thinking
of something like this, but it's not working.

WITH MEMBER [Measures].[CumulativeTimeCharged] AS

'SUM({NULL:[Date].[Week].CurrentMember},[Time Charged])'

SET [SixteenWeeks] AS

'Filter( [Date].[Day].Members,

[Date].[Day] >= STRTOMEMBER(@.graphStartDate, CONSTRAINED) AND

[Date].[Day] <= STRTOMEMBER(@.ToDate, CONSTRAINED))'

SELECT NON EMPTY

{

[Measures].[CumulativeTimeCharged]

} ON COLUMNS,

NON EMPTY

{

(

[Project].[Project Number].[Project Number].ALLMEMBERS *

[SixteenWeeks]

)

} ON ROWS

FROM

(

SELECT

(

Null:STRTOMEMBER(@.ToDate, CONSTRAINED)

) ON COLUMNS

FROM

(

SELECT

(

STRTOSET(@.Project, CONSTRAINED)

) ON COLUMNS

FROM [Timesheet_Cube]

)

)

Any suggestions?|||

Let me explain a little more.
Using the following query:

WITH MEMBER [Measures].[CumulativeTimeCharged] AS 

'SUM({NULL:[Header].[Week Ending].CurrentMember},[Time Charged])'

SELECT NON EMPTY

{

[Measures].[CumulativeTimeCharged]

} ON COLUMNS,

NON EMPTY

{

(

[Project].[Project Number].[Project Number].ALLMEMBERS *

[Header].[Week Ending].[Week Ending].ALLMEMBERS

)

} ON ROWS

FROM

(

SELECT

(

STRTOSET(@.Project, CONSTRAINED)

) ON COLUMNS

FROM [Timesheet_Cube]

)

I get the results on the screenshot at the following link:

http://picasaweb.google.com/fbalas/ScreenShots/photo#5000287345760862226

As you can see from the above results, I am getting
results from weeks before my desired range and results
after my desired range (which also are pretty useless
because there was no additional time after the cutoff so
the cumulative number is always the same).

Is my problem understandable the way I've presented it?

|||Sorry - I have hard time understanding your requirements. Do you want the running sum to run only from 16 weeks back, or do you want it to run from the beginning, but restrict to the subset of Weeks Ending in the report ?|||

Re Mosha:

Thanks for the reply.
What I'm looking for is more like using Tail() than head.
But if you look in the rest of the thread, my problem now
also includes filtering out records at the end as well.

|||

The second understanding is correct...

I want the cumulative sum to run from the beginning of
time, but I only want the last 16 weeks from the cutoff
time (which will be specified by the user using SSRS).

I will be graphing this data, that's why the user wants
to restrict it to only 16 weeks, so that they can see
the dates on the X-axis. If I were to include all the data,
the dates on the X-axis begin to get to small to read.

|||

I should also mention that I am a relative beginner
with this MDX stuff so if what I am asking is so blatantly
easy that you can't fathom why I didn't try something
completely different... please forgive me ;-)

|||

OK - if you need to get 16 weeks from the current week - you can use

StrToMember(@.CurrentWeek, CONSTRAINED) : StrToMember(@.CurrentWeek, CONSTRAINED).Lead(16)

If you need 16 weeks before the current week - you can use

StrToMember(@.CurrentWeek, CONSTRAINED).Lag(16) : StrToMember(@.CurrentWeek, CONSTRAINED)

HTH

Mosha

|||

Thank you so much Mosha! You just saved me
hours of frustration. I have 3 books now that I will
be going over to hopefully edumacate me on this topic ;-)

For those interested my final solution looked like:

WITH MEMBER [Measures].[CumulativeTimeCharged] AS

'SUM({NULL:[Header].[Week Ending].CurrentMember},[Time Charged])'

SELECT NON EMPTY

{

[Measures].[CumulativeTimeCharged]

} ON COLUMNS,

NON EMPTY

{

(

[Project].[Project Number].[Project Number].ALLMEMBERS *

{

StrToMember(@.ToDate, CONSTRAINED).Lag(15) : StrToMember(@.ToDate, CONSTRAINED)

}

)

} ON ROWS

FROM

(

SELECT

(

STRTOSET(@.Project, CONSTRAINED)

) ON COLUMNS

FROM [Timesheet_Cube]

)

|||

I have 3 books now

Is one of those books mine ? (Fast Track to MDX)

|||Actually yes, one of them is ;-)

Friday, March 9, 2012

Limiting no of rows in a page

Hi All
We have requirement where a user restrict no of rows which can be displayed
on a page on a report in this report we will be showing invoices for the
check on the top and corresponding check at the bottom. Here a user can set
no of invoices to be displayed on a page. This will always be less or equal
to actual limit which can be displayed.
For example we have 15 invoices but limit set to show on a page is 6 then
report should display only 6 rows in 1st page and another 6 on second page
and remaining on 3rd page.
Can any body let me know how can we restrict no of rows to be displayed on
single page. and also show check at the bottom.
Thanks in advance
Thanks and regds
Rehan Mustafa KhanI have placed several examples of this on www.msbicentral.com Go to
downloads,Reporting Services, RDL
--
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
"Rehan Mustafa Khan" <RehanMustafaKhan@.discussions.microsoft.com> wrote in
message news:E46DEAC4-A036-4D6B-9052-C2218B2ED052@.microsoft.com...
> Hi All
> We have requirement where a user restrict no of rows which can be
displayed
> on a page on a report in this report we will be showing invoices for the
> check on the top and corresponding check at the bottom. Here a user can
set
> no of invoices to be displayed on a page. This will always be less or
equal
> to actual limit which can be displayed.
>
> For example we have 15 invoices but limit set to show on a page is 6 then
> report should display only 6 rows in 1st page and another 6 on second page
> and remaining on 3rd page.
>
> Can any body let me know how can we restrict no of rows to be displayed on
> single page. and also show check at the bottom.
>
> Thanks in advance
>
> Thanks and regds
> Rehan Mustafa Khan
>

Limiting Matrix Columns

I am dealing with a report which must display records in columns. The number of columns is dynamic as is the number of fields (rows) which will be displayed.
For example, my data is structured as follows:
ID Name Price State Category etc...
1 Widget $100 AL Tools
2 Gadget $45 NY Accessories
3 Thingy $12.50 TX Tools
etc.
.
.
In order to convert this to a matrix, I have queried the data to return in the following format:
ID Attribute Value
1 Name Widget
1 Price $100
1 State AL
1 Category Tools
2 Name Gadget
2 Price $45
2 State NY
2 Category Accessories
3 Name Thingy
3 Price $12.50
3 State TX
3 Category Tools
etc...
So, I create a matrix in my report with 1 column and 1 row. The column is grouped on ID. The row is grouped on Attribute. The detail displays the Value. Giving me:
1 2 3 etc...
Name Widget Gadget Thingy
Price $100 $45 $12.50
State AL NY TX
Category Tools Accessories Tools
etc...
This all works great and is very simple. The problem stems from the fact that I only want to display a limited number of columns on each page. Once 8 columns are displayed, I would like the matrix to skip to a new page, which redisplays my header. Unfortunately, the matrix just keeps expanding to the right and never wraps. Is there any way to work around this? Has anyone found a way to force a matrix to wrap and repeat the headers?
Thanks

Hello:

I have just sstayed away from Matrix'es in that I have no control. I have not found a way around your above example - maybe someone else knows but I sure don't - so I have just stayed with simple lists and have manipulated the data via a stored procedure with a "crosstab" or "pivot table" to generate the data (with respective columns) that I want and then within RS just layout the report visibility similar to a matrix.

A different subject for a different day but the same occurs within Analysis Services in that the horizontal presentation just extrapolates itself forever based upon the dimensions and columns - maybe I did not say that corectly but the same thing occurs.
So here is a nice little "generic" SQL that will allow you to present your row data as column data. A side Note - that is the ONLY issue I have with Reporting Services in that all data is always represented as a ROW - so this Stored Procedure will definitely help you control what you want to present.
There are some initial definitions you should deploy such as storing these parameters for each report within a table in SQL and if you want I can help you - but nevertheless here is the code and I rename this Stored Procedure for the name of my Reporting Services Report.
CREATE procedure Ex_CrossTab or whatever name you want (@.SQL varchar(2500),

@.PivotCol varchar(100),

@.Summaries varchar(100),

@.GroupBy varchar(100),

@.OtherFields varchar(150) = Null,

@.Debug bit = 0)

AS

set nocount on

set ansi_warnings off

declare @.Vals varchar(8000);

declare @.Vals2 varchar(8000);

declare @.Vals3 varchar(8000);

declare @.tmp varchar(1000);

declare @.TotalLen int;

set @.Vals = '';

set @.Vals2 = '';

set @.Vals3 = '';

set @.TotalLen = len(@.SQL) + len(@.GroupBy) + Len(ISNULL(@.OtherFields,''))

set @.OtherFields = isNull(', ' + @.OtherFields ,'')

create table #temp (Pivot varchar(100))

insert into #temp

exec ('select distinct convert(varchar(100),' + @.PivotCol + ') as Pivot FROM (' + @.SQL + ') A')

select @.tmp =

replace(replace(@.Summaries,'(','(CASE WHEN ' + @.PivotCol + '=''' + replace(Pivot,'''',''') +

''' THEN '),')[', ' END) as [' + Pivot ),

@.TotalLen = @.TotalLen + Len(@.tmp),

@.Vals = case when @.TotalLen < 7800 then @.Vals + ', ' + @.tmp else @.Vals end,

@.Vals2 = case when @.TotalLen between 7800 and 15799 then @.Vals2 + ', ' + @.tmp else @.Vals2 end,

@.Vals3 = case when @.TotalLen between 15800 and 23799 then @.Vals3 + ', ' + @.tmp else @.Vals3 end

from
#Temp
order by
Pivot

drop table #Temp

if (@.Debug=0)

exec ( 'select ' + @.GroupBy + @.OtherFields + @.Vals + @.Vals2 +

@.Vals3 + ' from (' + @.SQL + ') A GROUP BY ' + @.GroupBy)

else

begin

create table #Temp2 (SQLText Text);

insert into #Temp2 (SQLText)

values ('select ' + @.GroupBy + @.OtherFields + @.Vals + @.Vals2 +

@.Vals3 + ' from (' + @.SQL + ') A GROUP BY ' + @.GroupBy);

select * from #Temp2

end


set nocount off
set ansi_warnings on
GO

The above code executes your SQL statement as Dynamic SQL so make sure that you get rid of all blanks within your SQL because it is passed as a parameter to the above stored procedure. So use Query Analyzer and once again eliminate all "white" space and then pass your SQL statement as a parameter to the above stored procedure. Based upon your SQL Select you can eliminate the data that is returned thus "eliminating" your columns from extroploating within Reporting Services.
Definitions on how to use the above stored procedure are below:


Select
- This is the SQL statement or table you are querying. It can be any valid SELECT statement, with JOINS, WHERE clauses, TOP, etc -- anything that you can cut and paste into query analyzer and execute. (And, in fact, you should always do this when testing things out).

Limiting Dataset for Chart but not Table

I have a report that has a single dataset that is used to populate both a
chart and a table. I want to limit the rows used by the chart but I want
the table to display all rows. I'm having difficulty determining how to
apply some sort of "rowcount <=10" condition to the chart's dataset. I
would like to avoid executing the same query twice.
I have been unable to find any references to this searching through this
group or the web (via google). Nor could I find anything in the Books
Online.
Is this possible or must I create two datasets, one that limits the number
of rows returned and another that returns all rows? If this can be done,
can someone please point me to an article that explains how?
Thanks,
ChrisChristopher,
SQL Server 2000 Reporting Services supports filtering on data regions
(table, matrix, list, and chart). Please see Reporting Services Books On
Line (BOL) for more information.
To access the filtering option for charts:
* Open the chart properties dialog
* Click on the Data tab
* Add or Edit a Category group (same applies to Series groups)
* Click on the Filtering tab
--
Bruce Johnson [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Christopher Walls" <msnews@.travantsolutions.com> wrote in message
news:uYHUnKUVEHA.1652@.TK2MSFTNGP09.phx.gbl...
> I have a report that has a single dataset that is used to populate both a
> chart and a table. I want to limit the rows used by the chart but I want
> the table to display all rows. I'm having difficulty determining how to
> apply some sort of "rowcount <=10" condition to the chart's dataset. I
> would like to avoid executing the same query twice.
> I have been unable to find any references to this searching through this
> group or the web (via google). Nor could I find anything in the Books
> Online.
> Is this possible or must I create two datasets, one that limits the number
> of rows returned and another that returns all rows? If this can be done,
> can someone please point me to an article that explains how?
> Thanks,
> Chris
>|||My category is on a field named "TargetOpenDate", so how do I setup the
filter? I cannot find any guidance either in the BOL or searching on Google
(web or groups).
I just want to limit the number of rows to the Top 5. I cannot leave the
Expression field blank. It seems no matter which field I select (either the
field I'm using for the category or some other arbitrary field), I get an
error "Fail to evaluate FilterExpression/FilterValues".
Expression: =Fields!TargetOpenDate.Value
Operator: Top N
Value: 3
Thanks,
Chris
"Bruce Johnson [MSFT]" <brucejoh@.online.microsoft.com> wrote in message
news:u7%23BJyVVEHA.4048@.TK2MSFTNGP12.phx.gbl...
> Christopher,
> SQL Server 2000 Reporting Services supports filtering on data regions
> (table, matrix, list, and chart). Please see Reporting Services Books On
> Line (BOL) for more information.
> To access the filtering option for charts:
> * Open the chart properties dialog
> * Click on the Data tab
> * Add or Edit a Category group (same applies to Series groups)
> * Click on the Filtering tab
> --
> Bruce Johnson [MSFT]
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> "Christopher Walls" <msnews@.travantsolutions.com> wrote in message
> news:uYHUnKUVEHA.1652@.TK2MSFTNGP09.phx.gbl...
> > I have a report that has a single dataset that is used to populate both
a
> > chart and a table. I want to limit the rows used by the chart but I
want
> > the table to display all rows. I'm having difficulty determining how to
> > apply some sort of "rowcount <=10" condition to the chart's dataset. I
> > would like to avoid executing the same query twice.
> >
> > I have been unable to find any references to this searching through this
> > group or the web (via google). Nor could I find anything in the Books
> > Online.
> >
> > Is this possible or must I create two datasets, one that limits the
number
> > of rows returned and another that returns all rows? If this can be
done,
> > can someone please point me to an article that explains how?
> >
> > Thanks,
> > Chris
> >
> >
>|||There is a trick. You need the value to be =3 instead of just 3. The
expression evaluator guesses that 3 is a string.
--
Brian Welcker
Group Program Manager
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Christopher Walls" <msnews@.travantsolutions.com> wrote in message
news:Or7f3JwVEHA.644@.tk2msftngp13.phx.gbl...
> My category is on a field named "TargetOpenDate", so how do I setup the
> filter? I cannot find any guidance either in the BOL or searching on
Google
> (web or groups).
> I just want to limit the number of rows to the Top 5. I cannot leave the
> Expression field blank. It seems no matter which field I select (either
the
> field I'm using for the category or some other arbitrary field), I get an
> error "Fail to evaluate FilterExpression/FilterValues".
> Expression: =Fields!TargetOpenDate.Value
> Operator: Top N
> Value: 3
>
> Thanks,
> Chris
>
> "Bruce Johnson [MSFT]" <brucejoh@.online.microsoft.com> wrote in message
> news:u7%23BJyVVEHA.4048@.TK2MSFTNGP12.phx.gbl...
> > Christopher,
> >
> > SQL Server 2000 Reporting Services supports filtering on data regions
> > (table, matrix, list, and chart). Please see Reporting Services Books On
> > Line (BOL) for more information.
> >
> > To access the filtering option for charts:
> >
> > * Open the chart properties dialog
> > * Click on the Data tab
> > * Add or Edit a Category group (same applies to Series groups)
> > * Click on the Filtering tab
> >
> > --
> > Bruce Johnson [MSFT]
> > Microsoft SQL Server Reporting Services
> >
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> >
> >
> > "Christopher Walls" <msnews@.travantsolutions.com> wrote in message
> > news:uYHUnKUVEHA.1652@.TK2MSFTNGP09.phx.gbl...
> > > I have a report that has a single dataset that is used to populate
both
> a
> > > chart and a table. I want to limit the rows used by the chart but I
> want
> > > the table to display all rows. I'm having difficulty determining how
to
> > > apply some sort of "rowcount <=10" condition to the chart's dataset.
I
> > > would like to avoid executing the same query twice.
> > >
> > > I have been unable to find any references to this searching through
this
> > > group or the web (via google). Nor could I find anything in the Books
> > > Online.
> > >
> > > Is this possible or must I create two datasets, one that limits the
> number
> > > of rows returned and another that returns all rows? If this can be
> done,
> > > can someone please point me to an article that explains how?
> > >
> > > Thanks,
> > > Chris
> > >
> > >
> >
> >
>|||Thanks, that worked.
"Brian Welcker [MSFT]" <bwelcker@.online.microsoft.com> wrote in message
news:ub6EY%23wVEHA.1656@.TK2MSFTNGP09.phx.gbl...
> There is a trick. You need the value to be =3 instead of just 3. The
> expression evaluator guesses that 3 is a string.
> --
> Brian Welcker
> Group Program Manager
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Christopher Walls" <msnews@.travantsolutions.com> wrote in message
> news:Or7f3JwVEHA.644@.tk2msftngp13.phx.gbl...
> > My category is on a field named "TargetOpenDate", so how do I setup the
> > filter? I cannot find any guidance either in the BOL or searching on
> Google
> > (web or groups).
> >
> > I just want to limit the number of rows to the Top 5. I cannot leave
the
> > Expression field blank. It seems no matter which field I select (either
> the
> > field I'm using for the category or some other arbitrary field), I get
an
> > error "Fail to evaluate FilterExpression/FilterValues".
> >
> > Expression: =Fields!TargetOpenDate.Value
> > Operator: Top N
> > Value: 3
> >
> >
> > Thanks,
> > Chris
> >
> >
> > "Bruce Johnson [MSFT]" <brucejoh@.online.microsoft.com> wrote in message
> > news:u7%23BJyVVEHA.4048@.TK2MSFTNGP12.phx.gbl...
> > > Christopher,
> > >
> > > SQL Server 2000 Reporting Services supports filtering on data regions
> > > (table, matrix, list, and chart). Please see Reporting Services Books
On
> > > Line (BOL) for more information.
> > >
> > > To access the filtering option for charts:
> > >
> > > * Open the chart properties dialog
> > > * Click on the Data tab
> > > * Add or Edit a Category group (same applies to Series groups)
> > > * Click on the Filtering tab
> > >
> > > --
> > > Bruce Johnson [MSFT]
> > > Microsoft SQL Server Reporting Services
> > >
> > > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> > >
> > >
> > > "Christopher Walls" <msnews@.travantsolutions.com> wrote in message
> > > news:uYHUnKUVEHA.1652@.TK2MSFTNGP09.phx.gbl...
> > > > I have a report that has a single dataset that is used to populate
> both
> > a
> > > > chart and a table. I want to limit the rows used by the chart but I
> > want
> > > > the table to display all rows. I'm having difficulty determining
how
> to
> > > > apply some sort of "rowcount <=10" condition to the chart's dataset.
> I
> > > > would like to avoid executing the same query twice.
> > > >
> > > > I have been unable to find any references to this searching through
> this
> > > > group or the web (via google). Nor could I find anything in the
Books
> > > > Online.
> > > >
> > > > Is this possible or must I create two datasets, one that limits the
> > number
> > > > of rows returned and another that returns all rows? If this can be
> > done,
> > > > can someone please point me to an article that explains how?
> > > >
> > > > Thanks,
> > > > Chris
> > > >
> > > >
> > >
> > >
> >
> >
>

Limiting data in Indexed Views by date

Hi everyone,
We have a fact table containing 28,000,000 rows and are experiencing
scalability issues when performing queries. It turns out that indexed
views are an excellent way to pre-calculate aggregates and improve
scalability.
The problem is that the table is part of an OLTP solution, and is
updated constantly throughout the day. However, our indexed view only
needs to include data up to yesterday (which never changes once it's
written). However, when we create an indexed view, it includes today's
data, and the overhead required to maintain the view is causing our
data insert routines to slow down by 90%.
What are our options to limit the data in the indexed view to
yesterday? Ideally, we'd like the index to automatically update at
midnight each night, without the need for replication or batch jobs.
Here are the options we know of:
1. Create indexed view without regard for the date. As stated above,
this slows down insert speeds on the table and is not feasible.
2. Create a copy of the table which contains data only up to yesterday,
and run the indexed query on this table. Run a batch process at 12:01am
every morning to copy the new rows to the new table. The table is very
large, so this will necessitate some downtime however.
Is there another simpler way to do this?On 1 Dec 2005 09:25:46 -0800, marketing@.adwarereport.com wrote:
(snip)
>What are our options to limit the data in the indexed view to
>yesterday?
(snip)
>Is there another simpler way to do this?
Hi marketing,
Have you considered creating a second database for reporting. Each
night, after the backup of the OLTP database has finished, load the
reporting database with that backup.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

Limiting data in Indexed Views by date

Hi everyone,
We have a fact table containing 28,000,000 rows and are experiencing
scalability issues when performing queries. It turns out that indexed
views are an excellent way to pre-calculate aggregates and improve
scalability.
The problem is that the table is part of an OLTP solution, and is
updated constantly throughout the day. However, our indexed view only
needs to include data up to yesterday (which never changes once it's
written). However, when we create an indexed view, it includes today's
data, and the overhead required to maintain the view is causing our
data insert routines to slow down by 90%.
What are our options to limit the data in the indexed view to
yesterday? Ideally, we'd like the index to automatically update at
midnight each night, without the need for replication or batch jobs.
Here are the options we know of:
1. Create indexed view without regard for the date. As stated above,
this slows down insert speeds on the table and is not feasible.
2. Create a copy of the table which contains data only up to yesterday,
and run the indexed query on this table. Run a batch process at 12:01am
every morning to copy the new rows to the new table. The table is very
large, so this will necessitate some downtime however.
Is there another simpler way to do this?
On 1 Dec 2005 09:25:46 -0800, marketing@.adwarereport.com wrote:
(snip)
>What are our options to limit the data in the indexed view to
>yesterday?
(snip)
>Is there another simpler way to do this?
Hi marketing,
Have you considered creating a second database for reporting. Each
night, after the backup of the OLTP database has finished, load the
reporting database with that backup.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)

Limiting data in Indexed Views by date

Hi everyone,
We have a fact table containing 28,000,000 rows and are experiencing
scalability issues when performing queries. It turns out that indexed
views are an excellent way to pre-calculate aggregates and improve
scalability.
The problem is that the table is part of an OLTP solution, and is
updated constantly throughout the day. However, our indexed view only
needs to include data up to yesterday (which never changes once it's
written). However, when we create an indexed view, it includes today's
data, and the overhead required to maintain the view is causing our
data insert routines to slow down by 90%.
What are our options to limit the data in the indexed view to
yesterday? Ideally, we'd like the index to automatically update at
midnight each night, without the need for replication or batch jobs.
Here are the options we know of:
1. Create indexed view without regard for the date. As stated above,
this slows down insert speeds on the table and is not feasible.
2. Create a copy of the table which contains data only up to yesterday,
and run the indexed query on this table. Run a batch process at 12:01am
every morning to copy the new rows to the new table. The table is very
large, so this will necessitate some downtime however.
Is there another simpler way to do this?On 1 Dec 2005 09:25:46 -0800, marketing@.adwarereport.com wrote:
(snip)
>What are our options to limit the data in the indexed view to
>yesterday?
(snip)
>Is there another simpler way to do this?
Hi marketing,
Have you considered creating a second database for reporting. Each
night, after the backup of the OLTP database has finished, load the
reporting database with that backup.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

Wednesday, March 7, 2012

Limitations of SQL Server Accelerator for BI

We are using BI Accelerator and we faced the problem that it is not possible
to insert new rows. We have some shared dimensions and when we define cubes
we also have to add list of dimensions. Very quickly we fill in the whole
space of the worksheet. The worksheet is protected and basically we do not
have any ability to have the whole Warehouse definition on one workbook. How
could we overcome this problem ?
There is not an easy solution to this.
In the latest version, there is a provision of controlling and invoking the
system via an XML file.
However, you will have to maintain the XML file yourself with your own XML
editor. Look in the 1.2 release notes and additional documentation.
Dave Wickert [MSFT]
dwickert@.online.microsoft.com
Program Manager
BI SystemsTeam
SQL BI Product Unit (Analysis Services)
This posting is provided "AS IS" with no warranties, and confers no rights.
"ksp" <ksp@.discussions.microsoft.com> wrote in message
news:FBB639F4-F70C-4756-AE17-2060DB3FC1C1@.microsoft.com...
> We are using BI Accelerator and we faced the problem that it is not
possible
> to insert new rows. We have some shared dimensions and when we define
cubes
> we also have to add list of dimensions. Very quickly we fill in the whole
> space of the worksheet. The worksheet is protected and basically we do not
> have any ability to have the whole Warehouse definition on one workbook.
How
> could we overcome this problem ?

Friday, February 24, 2012

limit to the number of rows a dataset can store?

hI,

I am using visual c# 2003 and sqlserver 2000 and i am trying to query a column in the sql server and store it into a dataset but i got an error msg:

The number of rows for this query will output 90283 rows.

------------------------
Query :

SELECT L_ExtendedPrice, COUNT (*) AS Count FROM LINEITEM GROUP BY L_ExtendedPrice ORDER BY Count DESC";

------------------------
Error msg :

An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll

Additional information: System error.
-------------------------

is there a limit to the number of rows a dataset can store?That's a lot of rows....

Can I ask what you plan to do with them?

And it's not really a sql server question...|||hi,

It is because I am a university student and i am doing my final year project on querying and i need these data to proceed on. I am researching on Small Group Sampling.

I was thinking that i am using sql server 2000 and maybe i can post this question in here as I am really in need of help for this.

thks|||Whatever you thought you wanted to do with the "dataset", why don't you want to do it on the server? All this "C#" and stuff is good, but only when used appropriately. Having a front-end with 90K+ rows is not a good idea, unless it's a report. But if that's the case, - it shouldn't be going into a "dataset."|||Originally posted by sunspot
hi,

It is because I am a university student and i am doing my final year project on querying and i need these data to proceed on. I am researching on Small Group Sampling.

I was thinking that i am using sql server 2000 and maybe i can post this question in here as I am really in need of help for this.

thks

OK, I'll byte...what's your major going to be in....|||Hi,

It is because I need to use the data in thwe dataset to do something else. This question is actually related to a question I posted on :

visual studio.net and sql server 02-12-04 22:01

I do not know what is the wrong things that I have done and that is why I am asking how many rows a dataset can store as I got error msg when I run the program.

limit the select to single row

Hello,
How can I limit the select statement to 1 single row ?
How can I limit the select statement to specific no. of rows ?
Thanks :)SELECT TOP 1
FROM ...
ORDER BY ...
SELECT TOP 10
FROM ...
ORDER BY ...
Note that without ORDER BY, which rows that are returned is undefined.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Eitan M" <no_spam_please@.nospam_please.com> wrote in message
news:%23lJnZbwoFHA.860@.TK2MSFTNGP12.phx.gbl...
> Hello,
> How can I limit the select statement to 1 single row ?
> How can I limit the select statement to specific no. of rows ?
> Thanks :)
>|||The obvious answer to your first question is to use a WHERE clause that
references a unique key.
In the second case you'll probably want to take a look at the SELECT
TOP n feature or use SET ROWCOUNT.
With TOP and ROWCOUNT be aware that unless you specify a unique key in
the ORDER BY clause or use the TOP WITH TIES modifier you may get
undefined results. That ought to be common sense but too many times I
see people omit to specify a well-defined criteria for a top n subset.
David Portas
SQL Server MVP
--