Showing posts with label implement. Show all posts
Showing posts with label implement. Show all posts

Monday, March 12, 2012

paging query in sql server compact edition

Hi,

I want to write query to implement paging in sql server ce 3.0. But it seems it does not support TOP or LIMIT keyword.

Can someone suggest alternative way to write a custom paging query in sql server ce 3.0.

Thanks,

van_03

You are correct, there is no intrisic support for paging the results from the query processor. What I do is use the SqlCeResultSet which has the ability to page through a range or records once you create the result set.

Darren

|||

Actually I have about 1 million rows in my table the sql sercer ce database. The table has no numeric field and no identity column either. I want to pick chunks of rows, may be about 100000 at a time. Then next chunk and so on. Can you suggest some way of acheiving this ?

Thanks,

van_03

Paging in SQL2000,help needed urgently

 Hi,

I urgently need help with this. I am trying to implement custom paging with Sql 2000. However I have ran into a few problems.
I really hope that someone would be able to help me out. I need to get this done by tomorrow!! (I know I screwed up big time, but I didn;t relize that built in paging fetches all the records, and the displays it page by page!!)

1) Currently the paging seems to be working. However the primary key always resets itself. For example, lets say I have 4 records ID 1,2,3,4
When I delete ID 3, instead of displaying ID 1,2,4 it shows ID 1,2,3. Is there any way to solve this problem?

2) The database that I am currently creating will have about 40,000 records, is it advisible for me to use your control (I hope so)?

Thank you and do have a nice day.

http://www.codeproject.com/aspnet/ASPNETPagerControl.asp

 
 
 
 
CREATE PROCEDURE [dbo].[GetPagedProducts11](@.PageSizeint,@.CurrentPageint,@.ItemCountint output)ASDeclare @.UpperBandint, @.LowerBandint-- Get The Count Of The Rows That They Meet the CriteriaSET @.ItemCount = (SELECTCOUNT(*)FROM aduan)-- Calculate the @.LowerCount and @.UpperCountSET @.LowerBand = (@.CurrentPage - 1) * @.PageSizeSET @.UpperBand = (@.CurrentPage * @.PageSize) + 1-- create a temporaty tableCREATE TABLE #AllRows(ad_idint PRIMARY KEY IDENTITY(1, 1),ad_namavarchar(40),ad_tarikhdatetime , ad_statusvarchar(30) ,ad_titlevarchar(100) )-- INSERT ALL THE Rows that meets the CriteriaINSERT INTO #AllRowsSELECT ad_nama,ad_tarikh, ad_status,ad_titleFROM aduan-- AND finally select and return desired -Paged- RowsSELECT ad_id, ad_nama, ad_tarikh, ad_status,ad_titleFROM #AllRowsWHERE ad_id > @.LowerBandAND ad_id < @.UpperBandRETURN

In the table aduan is ad_id a column name ?

If it is then replace

CREATE TABLE #AllRows(
ad_idint PRIMARY KEY IDENTITY(1, 1),
ad_namavarchar(40),ad_tarikhdatetime , ad_statusvarchar(30) ,ad_titlevarchar(100)
)

with

CREATE TABLE #AllRows(
ad_idint PRIMARY KEY,
ad_namavarchar(40),ad_tarikhdatetime , ad_statusvarchar(30) ,ad_titlevarchar(100)
)

-- INSERT ALL THE Rows that meets the Criteria
INSERT INTO #AllRows
SELECT ad_nama,ad_tarikh, ad_status,ad_title
FROM aduan

with

INSERT INTO #AllRows
SELECT ad_id ,ad_nama,ad_tarikh, ad_status,ad_title
FROM aduan

The problem you are having is because the Identity column is generated in the temporary table everytime you create it fresh.

This should solve your problem

|||

Hiambarishg,

thanks for your help. I really appreciate it :)

I have tried changing it to your code but it seems that no data is being passed back.

BTW ad_id is the primary key for the aduan table. any

|||Does
@.PageSizeint,@.CurrentPageint parameters have proper value when you are calling the SP?

Friday, March 9, 2012

Paging in MSSQL?

Hi,
What is the best way to implement page-loading using sql server? How can I
load, say 10 records starting from the 1001st one?
DWHere are a few options:
http://www.aspfaq.com/show.asp?id=2120
ML
http://milambda.blogspot.com/|||> Here are a few options:
> http://www.aspfaq.com/show.asp?id=2120
Nice page, thanks ;-)
DW|||Don't forget to thank the guys at aspfaq:
http://www.aspfaq.com/credits.asp
ML
http://milambda.blogspot.com/

Paging in MDX

Hi

I am new to mdx.i want to know can we implement paging in mdx query? is there any function in mdx so that i can return resultset based on count.i am using topcount function to return 10 rows.but i want to return result for next top 10 and so on.. in same query. like we do in paging.

Thanks in advance

There are probably ways of doing this, one that comes to mind would be to use a combination of topcount and tail

eg. page1... TopCount( <set>, <expression>, 10)

page2... TopCount( <set>, <expression>, 20).tail(10)

Paging

Is there any way to implement a paging scheme such that only the required records are transferred from SQL Server to the asp.net app?

The only support I can find such as the DataAdaptor.Fill will bring all the records back from SQL Server and then create the page...

This obviously still takes time and memory based on the entire query, not the page size.

Any ideas?Hi,

You can use a temporary table via stored proc in SQL Server. Seehere andhere.

Another approach is to use SELECT TOP, seehere.

A.|||Thanks... Very useful...

Having a fully dynamic query built up in asp.net, without necessarily being from a single table and having unknown (in advance) columns, without always having a primary key I'm not sure that I will be able to adapt one of these without doing some major work on my system.

Saturday, February 25, 2012

Page Size and Optimum Cluster Size

I would like to know the Page Size of SQL Server 2005.
If we implement SQL Server 2005 on SAN, what is the optimum size of the
cluster in NTFS format ? What is the relationship between the Page Size and
the cluster (Allocation Unit) size ?
Thanks"Jason" <Jason@.discussions.microsoft.com> wrote in
news:OmuTiWB8FHA.3388@.TK2MSFTNGP11.phx.gbl:
> If we implement SQL Server 2005 on SAN, what is the optimum size of
> the cluster in NTFS format ? What is the relationship between the
> Page Size and the cluster (Allocation Unit) size ?
On SQL Server 2000 the recommendation I've seen is 64k (One extent), and I
do think it is the same in SQL Server 2005.
One extent contains 8 pages. By using 64k allocation units, (in combination
with the same block size in the raid set/san) you have only one IO
operation on one single disk to read/write whole extent, thus reducing the
number of IOs when performing IO-intensive operations like a table scan.
--
Ole Kristian Bangås
MCT, MCDBA, MCDST, MCSE:Security, MCSE:Messaging

Page Size and Optimum Cluster Size

I would like to know the Page Size of SQL Server 2005.
If we implement SQL Server 2005 on SAN, what is the optimum size of the
cluster in NTFS format ? What is the relationship between the Page Size and
the cluster (Allocation Unit) size ?
Thanks"Jason" <Jason@.discussions.microsoft.com> wrote in
news:OmuTiWB8FHA.3388@.TK2MSFTNGP11.phx.gbl:

> If we implement SQL Server 2005 on SAN, what is the optimum size of
> the cluster in NTFS format ? What is the relationship between the
> Page Size and the cluster (Allocation Unit) size ?
On SQL Server 2000 the recommendation I've seen is 64k (One extent), and I
do think it is the same in SQL Server 2005.
One extent contains 8 pages. By using 64k allocation units, (in combination
with the same block size in the raid set/san) you have only one IO
operation on one single disk to read/write whole extent, thus reducing the
number of IOs when performing IO-intensive operations like a table scan.
Ole Kristian Bangs
MCT, MCDBA, MCDST, MCSE:Security, MCSE:Messaging

Page Size and Optimum Cluster Size

I would like to know the Page Size of SQL Server 2005.
If we implement SQL Server 2005 on SAN, what is the optimum size of the
cluster in NTFS format ? What is the relationship between the Page Size and
the cluster (Allocation Unit) size ?
Thanks
"Jason" <Jason@.discussions.microsoft.com> wrote in
news:OmuTiWB8FHA.3388@.TK2MSFTNGP11.phx.gbl:

> If we implement SQL Server 2005 on SAN, what is the optimum size of
> the cluster in NTFS format ? What is the relationship between the
> Page Size and the cluster (Allocation Unit) size ?
On SQL Server 2000 the recommendation I've seen is 64k (One extent), and I
do think it is the same in SQL Server 2005.
One extent contains 8 pages. By using 64k allocation units, (in combination
with the same block size in the raid set/san) you have only one IO
operation on one single disk to read/write whole extent, thus reducing the
number of IOs when performing IO-intensive operations like a table scan.
Ole Kristian Bangs
MCT, MCDBA, MCDST, MCSE:Security, MCSE:Messaging

Monday, February 20, 2012

Page Numbering

Hey all,

I would like to implement Page numbering like the examplem below.

my report contains 10 different projects; is there a way were i can get page numbering like page 1 of n, 2 of n etc where n gets reset for each project. The reason for this is that my report is broken down by project and issued to the individual project managers so the N is the number of pages for the project not the overall number of pages in the report...

any ideas any1...

help will be much appreciated.

Hey its very easiy to do,

just use the IIf Statement and print value in text box.

to do so explore the expression.