Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MS SQL Server


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Page Number && Records Number


1. how to show page number & total page number in report body?

2. how to show total records number?




View Complete Forum Thread with Replies

Related Forum Messages:
COnfiguring Number Of Records Per Page?
Is there a way I can specify how many records per page should be displayed?> This is a very basic functionality that needs to go in the deployment at any cost for us?...any ideas.

View Replies !
Set A Number Of Records Per Page In Reporting Services
 

Is it possible to set a page to display only certain number of
records at a time? Like 20 records per page?
 
thanks a lot

View Replies !
Get Page Number
Hi, I need to get page number of a data row. Does SQL Server 2005 support it? Please help me

Thanks

View Replies !
How Do I Get Page Number For DBCC PAGE?
I would like to look at the way my data is stored in the page. I have done this for a long time on Sybase, but I am having trouble with the page number on MS SQLServer 2000. I have a 5 row table. When I select INDID and FIRST from SYSINDEXES, I get
indid first
------ --------------
1 0x370300000100

I have tried all manner of gyrations to put this in to the DBCC PAGE command. No matter how I do it, I get an error saying that page is not part of the database, or the format is wrong. From my searching and reading, I think that this actually a combination number, consisting of the file and page number, but I can't see how to separate it. Any assistance would be appreciated. A link to documentation on internals, such as system table details and page formats would be most helpful. I looked in Ken Henderson's book on architecture and internals, and could not find it.

Or is there a DBCC command that will tell me more about the table, and perhaps give me the page number in decimal? So far, I can only find the checkdb gives that info on errors only.

Thanks for looking at this with me.

Doug W
Hunt Valley, Md

View Replies !
Page Number In Body
how to get page number in body of report

View Replies !
List Box Page Number
Hello,

 

I have a matrix inside a list box that groups by "question id" to display matrices with summaries for each question. I have checked the box "Insert page break after this list".

 

I want to be able to place the list box number next to the question, so that I will see something like:

 

1. Name

2. Category

3. Age

 

Is there a way to do this? Can I access the current number within the list? If I try the Globals!PageNumber variable, I get an error saying that the variable can only be used in a header or footer.

 

Thanks,

 

Michael

View Replies !
Page Number Issue
 

Hello All,
 
I need some help with a page number issue.  I have a report that looks great, and runs like it is supposed to, except I cannot get the page numbers to reset properly.  The report can span several document numbers in one query run, and I would like the page number to reset each time a new document number is found in the recordset.  Right Now, SSRS does not seem to have this capabiliry, and I am looking for a creative solution.
 
Example:
 
What SSRS actual does:
 
Actual Page        Document                          SSRS Page Display
1                        Document 1                                    1
2                        Document 1                                    2
3                        Document 1                                    3
4                        Document 2                                    4
5                        Document 2                                    5
 
What I need it to do:
 
Actual Page        Document                          SSRS Page Display
1                        Document 1                                    1
2                        Document 1                                    2
3                        Document 1                                    3
4                        Document 2                                    1
5                        Document 2                                    2
 
Any suggestions?
Many thanks in advance!
-Tom

View Replies !
Report Page Number
Hi all. how make a page number at the buttom of the report. I can't find it in Business Intelligence project.

Thanks.
-Ron-

View Replies !
Specify The Number Of Records
Hi,
I want to the users to specify the number of TOPn records to be returned by the query.It has to be a query and not a stored proceedure.
Thanx

View Replies !
How To Get Each Number Of Records...
HI EVERYBODY
This is my procedure
"
CREATE PROCEDURE SP_SAMPLE_SEARCH
@Title nvarchar(256)
AS

SELECT ID,Title,Price FROM [tbl_Sim] WHERE ([Title] LIKE '%' + @Title + '%') Order by Price desc
GO
"
I exec procedure and it returns 12 results with diffirents ID
and want to get these values 1,2,3....12
How do I get these...
I am a beginner.
Thanks for help..

View Replies !
Formating A Number To Show $23.49 From Sql Server Into An Asp Web Page
Hi,
I need to make the format by pulling the number from a table from sql server 7.0 and show the result in a table and have the following format $120,534.45 is that possible.

Thanks
Ali

View Replies !
Hiding A Table Row Depending On Page Number?
Hi, Everyone.
i am wondering if there is some way to hide a table row depending on the page number.
I have tried to find a way to access the global page number to use it in an expression for the visibility property on the table row, but i havent found anything useful.

View Replies !
Extending The Number Of Rows Returned Per Page In RS
Is there a way to extend the number of rows that will be returned so that Reporting services doesn't display such a large number of pages for the users to page through?  It would be easier for them to "wheel mouse" through a long page on the screen.

 

Anyone out there have any thoughts on how this might be accomplished?

 

Thanks!

 

Travis

View Replies !
Reset Total Page Number In A Group
I know how to reset the page numbers with each group, but how do you reset the total page number within each group.

EX.  Code for page of total pages

="Page " & Globals.PageNumber & " of  " & Globals.TotalPages

 

EX. Code to reset within a group
Custom Code:
Shared offset as Integer
Shared currentgroup as object
 
Public Function GetGroupPageNumber(group as Object, pagenumber as Integer) as Object
If not (group = currentgroup)
offset = pagenumber - 1
currentgroup= group
end if
return pagenumber - offset
end function
 
=Code.GetGroupPageNumber(ReportItems!Category.Value(grouping),Globals!PageNumber)
 
What I need is code for a combination of the two...to display code for page of total pages that resets within a group.
 
Any help is greatly appreciated.
Thanks!

 

View Replies !
How To Limit Number Of Rows Showing Each Page?
Hi All,

i couldn't find how to set up the number of rows displaying on each page?

i wanna each page display 20 rows.

 

Thanks

Nick

View Replies !
Page Number In ReportExecution2005 - Render Method
Hello,
 
I am trying to render a Report in HTML4.0 format using ReportExecution2005 web service's Render method. When I use this, I am getting  all the results in a single page. I want to display the results page by page as ReportViewer control does. Is there any way to get the total number of pages of the Result using Render() web method?
 
I tried using the following deviceinfo:

"<DeviceInfo><StreamRoot></StreamRoot><Toolbar>True</Toolbar><Parameters>True</Parameters><Section>0</Section><HTMLFragment>false
</HTMLFragment></DeviceInfo>";

 Any help or suggestions would be appreciated.

View Replies !
Resetting Page Number On Group Break
 

Hi,
I have a report where i do a page break for each supplier. I want to reset my page number to '1' when there is a group break.When i googled for this functionality i found the following chris Hay's blog which provides the solution.
http://blogs.msdn.com/chrishays/archive/2006/01/05/ResetPageNumberOnGroup.aspx
But if i follow the same, I get #Error instead of page number during the run time.How do i resolve the error?
Also, I want to display the "page 1 of totalpages in group" like that. Is that possible?
 
Thanks in advance

View Replies !
How To Control Rendering Number Of Groups Per Page
 

Is there  a way that i can render only 3 groups per page. Instead of the SSRS automatically rendering on its own
is there a way i can decide how many groups are rendered in 1 page.

 
I get output like this: when i dont keep pagebreak at end i get it like this displaying only half of the 4th group and the remianing half in next page.
 
Texas
      abc pqr city1
      ber cyh city2

illinois
     abc pqr city1
      ber cyh city2
Denver
      abc pqr city1
      ber cyh city2
Wiscon
      abc pqr city1
 
However i would need o/p like this
 
Texas
      abc pqr city1
      ber cyh city2
illinois
      abc pqr city1
      ber cyh city2
Denver
      abc pqr city1
      ber cyh city2
 
Pushing that 4th group to the next page...
 
 
Any ideas....
 
 
Thanks in advance..
Pav

     
 
   

View Replies !
How To Enter More Number Of Rows In A Table Having More Number Of Columns At A Time
Hi

I want to enter rows into a table having more number of columns
 
For example : I have one employee table having columns (name ,address,salary etc )
                     then, how can i enter 100 employees data at a time ?

Suppose i am having my data in .txt file (or ) in .xls

( SQL Server 2005)

View Replies !
Count Number Of Records
Using linq what would be the most efficient method of counting the number of users in the users table? 

View Replies !
How To Count Number Of Records
hi
can anyone tell me how to count number of records(rows) in a table without using "COUNT" function.for practise iam trying to implement it through queries.

View Replies !
Number Of Affected Records
Okay..i have this problem ...i am using SQL server 2005 standard ,C#,VS2005
--i am inserting some record in DB .. using ExecuteNonQuery...i want to know how many records are getting inserted..so in my DB class i did something like this : numRecords = commandObject.ExecuteNonQuery() ,assuming  that ExecuteNonQuery returns the number of affected records.i am retriving this numOfRecords in my code behind and printing it but it always prints 1,even though more then one records are inserted.What is wrong here?
-i also have returnValue defiend like this.Could this tell me anything about how many records are inserted or affected during update,select ?if so,how?
cmd.Parameters.Add(new SqlParameter("@returnVal", SqlDbType.Int));
cmd.Parameters["@returnVal"].Direction = ParameterDirection.ReturnValue;
Please help me out with this.Thanks

View Replies !
How Can I Now The RecordSource Number Of Records?
Hi...
I just begining to use the asp.net 2.0 and have tow littel problems... in my project the user makes a "list of problems on a house" when hi post the house number the page shoud to generete a master recod with a keynumber, the date an hour and the state of problems... and a form to insert a list of problems... but if the house dosn´t exist this forms are hidden... then i need to know the nomber of records that gets a recordsource if its more than cero show the forms else hiden it... if show the forms i need to store in a variable the keynumber to store it in the problem details table... ¿How i can khow the number of records of a RecordSource gets?... and ¿How I can store in a variable a field value retrived for a RecordSource?... I´m using VWD and SQL Express that means ADO.NET 2.0...
cheers.

View Replies !
Getting Number Of Records Modified
Hi all

My manager ask me to provide him with the total number of records which have been added, deleted or modified on a certain database in SQL Server 2000 during the month of September. Is there away to get that information from the transaction log or by any how?

please some one guide me how to do that?

Your help is highly appreciated

View Replies !
Total Number Of Records
Hi everbody,

I want find out Total number records in one table without using select statment.
Some body as told to me there is system table you can find total number of records. Any body give me systable name.
Thanks
Jack

View Replies !
Total Number Of Records
Hi everbody,

I want find out Total number records in one table without using select statment.
Some body as told to me there is system table you can find total number of records. Any body give me systable name.
Thanks
Jack

View Replies !
How Do I Put Records Number In Union
 

Hi i have sql statement like this :
 
SELECT row_number() over (ORDER by a.empid) as rec_num, empname
FROM employee_a
UNION
SELECT row_number() over (ORDER by a.empid) as rec_num, empname
FROM employee_b
 
the problem is the rec_num repeat for each statement like this :
 



rec_num              empname

 1                        john
 2                        maggy
1                         lee
2                         mary
3                         louis
 
How do i make the rec_num continue for the next statement after union.

View Replies !
Sequence Number For Records
Hi...
 
I have Sql statement more like this
 
SELECT row_number() over (ORDER by a.employeeID) as rec_num, a.* FROM EmployeeA a
UNION
SELECT row_number() over (ORDER by a.employeeID) as rec_num, a.* FROM EmployeeB a
 
 
                   rec_num      employeeID    employeeName      employeeDepartment


    1                 777           Mike                              HR
    2                 888           Susy                              HR
    1                 111           Smith                            TECH
    2                 222           John                              TECH
    3                 333           Lenny                            TECH  
 
 

How do i get sequence number for all of this records. The rec_num reset for every statement. I want the records numbering for second statement continue from first statement so that it can be like this :
 
                   rec_num      employeeID    employeeName      employeeDepartment


    1                 777           Mike                              HR
    2                 888           Susy                              HR
    3                 111           Smith                            TECH
    4                 222           John                              TECH
    5                 333           Lenny                            TECH  

View Replies !
Restricting Number Of Records
I want to restrict the number of records coming from an OLEDB source. I have 500 records in my source table and I want to process one record at a time

I have I set the MaxBufferRows parameter to 1and it l sends  8 records from OLEDB source

Any help is appreciated.

View Replies !
Getting The Number Of Records With Like Values
I have a resultset that looks something like this:

Anzahl    users_statdata_hobbies
---------------------
    499    Andere
    266    Essen
    60      Essen,Andere
    127    Essen,Musik
    10      Essen,Musik,Party,Andere
    30      Essen,Party
    4        Essen,Party,Andere
    51      Kunst
    4        Kunst,Andere
    13      Kunst,Essen
    4        Kunst,Essen,Andere

I get this with this query which might be altered somehow:



SELECT     COUNT(*) AS Anzahl, users_statdata_hobbies

FROM         vgetAuswertung2

GROUP BY users_statdata_hobbies

ORDER BY users_statdata_hobbies

Of course this is not normalized but I can't change this.

Nevertheless I need to get the full number of each Hobby and not only the combination of them.

So instead or in addition to the existing recordset I need e.g

357    Essen which ist the sum of all records containing 'Essen' in the above example

The list of individual hobbies is defined therefor I could loop through the list manually and search for 'WHERE Hobbies LIKE '%ESSEN%' and count but since it's quiet a big resultset and there are several other similar tasks already I'm looking for a more performant way and I'm sure it could be done in SQL directly.

Any ideas someone?

View Replies !
DISTINCT And Number Of Records
Wondering if there is a way to do this...
 
I want to select the DISTINCT user name from each record in a table, and then have another field tell me how many records it found..
 
is there any way to do this with SQL?
 

SELECT DISTINCT user_Name FROM table ORDER BY user_Name

 
is what I have now....

 
need something that will return:
 
user_Name         numRecs
bob                         3
fred                         6
sam                        1
linda                        2

View Replies !
Sum Up An Unknown Number Of Records
With this algorithm you can sum up an unkown number of records, so that an aggregation matches a fixed value.
If there is not an exakt match available, the algorithm returns the nearest possible value!-- Initialize the search parameter
DECLARE@WantedValue INT

SET@WantedValue = 349

-- Stage the source data
DECLARE@Data TABLE
(
RecID INT IDENTITY(1, 1) PRIMARY KEY CLUSTERED,
MaxItems INT,
CurrentItems INT DEFAULT 0,
FaceValue INT,
BestUnder INT DEFAULT 0,
BestOver INT DEFAULT 1
)

-- Aggregate the source data
INSERT@Data
(
MaxItems,
FaceValue
)
SELECTCOUNT(*),
Qty
FROM(
SELECT 899 AS Qty UNION ALL
SELECT 100 UNION ALL
SELECT 95 UNION ALL
SELECT 50 UNION ALL
SELECT 55 UNION ALL
SELECT 40 UNION ALL
SELECT 5 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 50 UNION ALL
SELECT 250 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 90 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 50 UNION ALL
SELECT 350 UNION ALL
SELECT 450 UNION ALL
SELECT 450 UNION ALL
SELECT 100 UNION ALL
SELECT 100 UNION ALL
SELECT 50 UNION ALL
SELECT 50 UNION ALL
SELECT 50 UNION ALL
SELECT 1 UNION ALL
SELECT 10 UNION ALL
SELECT 1
) AS d
GROUP BYQty
ORDER BYQty DESC

-- Declare some control variables
DECLARE@CurrentSum INT,
@BestUnder INT,
@BestOver INT,
@RecID INT

-- If productsum is less than or equal to the wanted sum, select all items!
IF (SELECT SUM(MaxItems * FaceValue) FROM @Data) <= @WantedValue
BEGIN
SELECTMaxItems AS Items,
FaceValue
FROM@Data

RETURN
END

-- Delete all unworkable FaceValues
DELETE
FROM@Data
WHEREFaceValue > (SELECT MIN(FaceValue) FROM @Data WHERE FaceValue >= @WantedValue)

-- Update MaxItems to a proper value
UPDATE@Data
SETMaxItems =CASE
WHEN 1 + (@WantedValue - 1) / FaceValue < MaxItems THEN 1 + (@WantedValue - 1) / FaceValue
ELSE MaxItems
END

-- Update BestOver to a proper value
UPDATE@Data
SETBestOver = MaxItems

-- Initialize the control mechanism
SELECT@RecID = MIN(RecID),
@BestUnder = 0,
@BestOver = SUM(BestOver * FaceValue)
FROM@Data

-- Do the loop!
WHILE @RecID IS NOT NULL
BEGIN
-- Reset all "bits" not incremented
UPDATE@Data
SETCurrentItems = 0
WHERERecID < @RecID

-- Increment the current "bit"
UPDATE@Data
SETCurrentItems = CurrentItems + 1
WHERERecID = @RecID

-- Get the current sum
SELECT@CurrentSum = SUM(CurrentItems * FaceValue)
FROM@Data
WHERECurrentItems > 0

-- Stop here if the current sum is equal to the sum we want
IF @CurrentSum = @WantedValue
BREAK
ELSE
-- Update the current BestUnder if previous BestUnder is less
IF @CurrentSum > @BestUnder AND @CurrentSum < @WantedValue
BEGIN
UPDATE@Data
SETBestUnder = CurrentItems

SET@BestUnder = @CurrentSum
END
ELSE
-- Update the current BestOver if previous BestOver is more
IF @CurrentSum > @WantedValue AND @CurrentSum < @BestOver
BEGIN
UPDATE@Data
SETBestOver = CurrentItems

SET@BestOver = @CurrentSum
END

-- Find the next proper "bit" to increment
SELECT@RecID = MIN(RecID)
FROM@Data
WHERECurrentItems < MaxItems
END

-- Now we have to investigate which type of sum to return
IF @RecID IS NULL
IF @WantedValue - @BestUnder < @BestOver - @WantedValue
-- If BestUnder is closer to the sum we want, choose that
SELECTBestUnder AS Items,
FaceValue
FROM@Data
WHEREBestUnder > 0
ELSE
-- If BestOver is closer to the sum we want, choose that
SELECTBestOver AS Items,
FaceValue
FROM@Data
WHEREBestOver > 0
ELSE
-- We have an exact match
SELECTCurrentItems AS Items,
FaceValue
FROM@Data
WHERECurrentItems > 0With references to
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=73540
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=73610
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=78015
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=79505


Peter Larsson
Helsingborg, Sweden

View Replies !
Selecting A Certain Number Of Records?
Hi,

Here is a basic example of the issue I am having:

Table 1 columns - name, address, zipcode, favorite food

For table 2 I want to find how many zipcodes exists and also take 20% of the count

Table 2 columns - based off Table 1 contains zipcode, count(zipcode) as ct, count(zipcode) * .20 as perc_ct

For example:

zipcode ct perc_ct
83746 10 2
93847 20 4

I want to run a query that will pull any 2 records for 83746 and any 4 records for 93847 from Table 1.

Is this possible?

View Replies !
My Number Of Records Are Different From Views
Why is it my number of records are different from my view. this are the following code that that i used in my code and in my view.

my code in my program: this code show all the records i know

If iConn.State = ConnectionState.Open Then iConn.Close()
iConn.Open()
Dim rsBills As New Data.DataSet
rsBills = New DataSet
Dim daBills As New SqlDataAdapter
daBills = New SqlDataAdapter
rsBills.Clear()
Dim cmBills As New SqlCommand
cmBills = iConn.CreateCommand ' "Select U_Code, U_Name, U_Level, P_Word From EPassword ",
cmBills.CommandText = "Select OR_no, Billing_mo From dbo.vwBilling Where Month(dbo.vwBilling.Billing_mo)= " & Month(Me.dtto.Value) & " And Year(dbo.vwBilling.Billing_mo) = " & Year(Me.dtto.Value) & " ORDER BY OR_no "

daBills.SelectCommand = cmBills
rsBills.AcceptChanges()
rsBills.Clear()
daBills.Fill(rsBills, "Bills")
Me.DataGridView1.DataSource = Nothing
Me.DataGridView1.DataSource = rsBills.Tables("Bills")

my code in views:

SELECT OR_no, Billing_mo, Account_no, Name, Address, Cno, Pres_read, Mprev_read, Sub_read, Pres2, Prev2, SRead2, Mtr_cons, Amount, NPC, Dmem,
Cmem, Tot_bill, D_Pmnt, Class, Newbill, Prd_fr, Prd_to, Type_Pmnt, Type_Date, Type_Docs, wtax
FROM dbo.Billing


hope you can help me guys

View Replies !
Limit On Number Of Records
is there a limitations of number of records that shows in the table when you use show data table?

View Replies !
Counting Total Number Of Queries Executed Within The Page
Hi everyone,Does exist an easy way to count the actually number of queries executed within a page?I've searched here and in google but found anything...Thanks in advance! 

View Replies !
Restore Gives &#39;invalid Logical Page Number&#39; Error
We tried to restore an empty database from a backup and got:
'Load database encountered an invalid logical page number' error.
This then set the database as 'loading'

Anyone got any ideas?

We aren't exactly sure how big the first database was when the backup was done but if the new database isn't big enough to contain the backed up data, wouldn't we get a more meaningful error?

Janet

View Replies !
How To Make Footers Page Number Appear When I Print The Report
I have the footer with the following in it,

**********************************

= " Page " & Globals!PageNumber & " of " & Globals!TotalPages & "       " & String.Format(Globals!ExecutionTime, "dd-MM-yyy uu:mm")

********************************

When i view the report it shows the page number and time, but when i print it does'nt appear at all on the print paper( page number and time)

is there a trick to make it appear on the print.

Thank you very much.


 

View Replies !
Limitations In Term Of Number Of Tasks And Number Of Columns
Hi,

I am currently designing a SSIS package to integrate data into a data warehouse fact table. This fact table has about 70 columns among which 17 are foreign keys for dimension tables.

To insert data in that table, I have to make several transformations and lookups. Given the fact that the lookups I have to make are a little complicated, I have about 70 tasks in my Data Flow.
I know it's a lot, but I can't find a way to make it simpler. It seems I really need all these tasks.
 
Now, the problem is that every new action I try to make on the package takes a lot of time. At design time, everything is very slow. My processor is eavily loaded each time I change a single setting in one of the tasks, and executing the package in debug mode takes for ages. If I take a look at the size of my package file on disk, it's more than 3MB.

Hence my question : Are there any limitations in terms of number of columns or number of tasks that can be processed within a Data Flow ?

If not, then do you have any idea why it's so slow ?

Thanks in advance for any answer.

View Replies !
How To Change A Decimal Number To Percent Format Number?
in my sql, i want to change a decimal number to percent format number, just so it is convenient for users. for example there is a decimal number 0.98, i want to change it to 98%, how can i complete it?

thks

View Replies !
Search For Records That Begins With A Number (0-9)?
Hi all,For now I can use this code to display all the records that begins with a Letter:(WHERE SONG_TITLE LIKE @SONG_TITLE + '%') Now how do I search for records that begins with a number (from 0-9), as an add-on to the above query?Thank you very much,Kenny. 

View Replies !
Number Of Records In SQLDataSource/GridView
What is the easiest way to obtain number of records in SQLDataSource (using select statement)/GridView. All that I've found in forums seems to be very difficult for such trivial task... Thank you!

View Replies !
Returning Limited Number Of Records!
I am using ORDER BY NEWID() to return random record from sql database. how do i go about returning only 5 random records instead of all records.

Thanks.

View Replies !
Obtaining The Number Of Records In A SqlDataReader
Can anyone tell me how I can obtain the number of records returned in a sqlDataReader recordset?

View Replies !
Select Specific Number Of Records
Dear GroupI wonder whether you can give me a syntax example for a SQL Statement.Lets assume I've a table containing three columns ContactID (Primary Key),Firstname and Lastname.I would like to write a stored procedure which returns me the first tenrecords and increments an outside variable each time it runs.E.g If I run it the first time I pass the variable as 0 and it will returnme the first ten records and returns the variable value 1.When run a second time, I will pass the variable as 1 and it will return merecords 11-20 and sets the variable to 2 and so on...The difficult thing is how to tell to return me records 11-20. I can't usethe ContactID as someone might have deleted a row and e.g. ContactID 18 ismissing. In this case I only would get 9 rows returned. It always should beten.Thanks very much for your time and efforts!Kind Regards,Martin"There are 10 types of people in this world: Those that understand binaryarithmetic, and those that don't."

View Replies !
Decreasing Number Of Records.. Is It Important?
hi,If we consider the following scenerio:a school with 500 students.On average student takes [x] courses per year, and [y] tests per course.table of grades:+------------+-----------+---------+-------+| student_id | course_id | term_id | grade |+------------+-----------+---------+-------+| | | | |+------------+-----------+---------+-------+| | | | |+------------+-----------+---------+-------+as average, x = 20, y =6 thennumber of records = 500 * 20 * 6 = 120,000 record per year.is this design correct considering number of records generated per year?Is it important to reduce the "number of records" or no?thank you.

View Replies !
Restrict The Number Of Records From Query
Hi,

ive a table of over 90,000 records . is ther any method for restricting the number of records returned by a SELECT query

i want to implement a query system which will give me the first 50 records, next 50 ,... and so on


can ne body help ?

View Replies !
Batching Large Number Of Records Using ADO
Hi,

First, thank you Kurt & Nguyen for replying to my last message.

My problem:
I need to insert a very large number of rows, from memory (and NOT from file) into a table
(in SQL Server 7.0) using ADO. Performance is the big issue and I need to do this as efficiently
as possible. I cant use BCP, BULK INSERT etc as I am using ADO to do this. MS documentation
appears to suggest using 'AddNew' and 'UpdateBatch' for this purpose, but my attempt at
batching it this way is exteremly slow (please look at my code below).

Here is my failed attempt at batching large number records using ADO:

void myAttemptAtBatchingUsingADO()
{
try
{
// Make connection
CoInitialize(NULL);
_ConnectionPtr pConn = 0;
pConn.CreateInstance( __uuidof(Connection));
pConn->Open("dsn=myDB;", "myUser", "batch", adConnectUnspecified);

// open recordsert
_RecordsetPtr pRS = 0;
HRESULT hr = pRS.CreateInstance( __uuidof(Recordset) );
pRS->CursorType = adOpenKeyset;
pRS->LockType = adLockBatchOptimistic;
pRS->Open(_bstr_t(L"myDB..myTable"), pConn.GetInterfacePtr(),
adOpenKeyset, adLockBatchOptimistic, adCmdTable);

// say 1000 records.
for(short n=0; n<1000; n++)
{
pRS->AddNew();
pRS->Fields->GetItem("myCOL1")->Value = n;
pRS->Fields->GetItem("myCOL2")->Value = n;
pRS->Fields->GetItem("myCOL3")->Value = "xyz";
pRS->Update();
}

// Batch it.
pRS->UpdateBatch(adAffectAll);

// Close ...
pRS->Close();
pConn->Close();
CoUninitialize();
}
catch( _com_error &Ex )
{
}
catch(...)
{
}
}

Can you please help with batching in ADO!!

Thanks

View Replies !
Batching Large Number Of Records Using ADO
Hi,

First, thank you Kurt & Nguyen for replying to my last message.

My problem:
I need to insert a very large number of rows, from memory (and NOT from file) into a table
(in SQL Server 7.0) using ADO. Performance is the big issue and I need to do this as efficiently
as possible. I cant use BCP, BULK INSERT etc as I am using ADO to do this. MS documentation
appears to suggest using 'AddNew' and 'UpdateBatch' for this purpose, but my attempt at
batching it this way is exteremly slow (please look at my code below).

Here is my failed attempt at batching large number records using ADO:

void myAttemptAtBatchingUsingADO()
{
try
{
// Make connection
CoInitialize(NULL);
_ConnectionPtr pConn = 0;
pConn.CreateInstance( __uuidof(Connection));
pConn->Open("dsn=myDB;", "myUser", "batch", adConnectUnspecified);

// open recordsert
_RecordsetPtr pRS = 0;
HRESULT hr = pRS.CreateInstance( __uuidof(Recordset) );
pRS->CursorType = adOpenKeyset;
pRS->LockType = adLockBatchOptimistic;
pRS->Open(_bstr_t(L"myDB..myTable"), pConn.GetInterfacePtr(),
adOpenKeyset, adLockBatchOptimistic, adCmdTable);

// say 1000 records.
for(short n=0; n<1000; n++)
{
pRS->AddNew();
pRS->Fields->GetItem("myCOL1")->Value = n;
pRS->Fields->GetItem("myCOL2")->Value = n;
pRS->Fields->GetItem("myCOL3")->Value = "xyz";
pRS->Update();
}

// Batch it.
pRS->UpdateBatch(adAffectAll);

// Close ...
pRS->Close();
pConn->Close();
CoUninitialize();
}
catch( _com_error &Ex )
{
}
catch(...)
{
}
}

Can you please help with batching in ADO!!

Thanks

View Replies !
Updating Records With A Incremental Number
I'm trying to update every record with a incremental number. I wrote the following query but it updates the records with the same number. Could someone please tell me what I'm doing wrong? Thanks.

declare @NextKey int
SELECT @NextKey = NEXT_KEY FROM TABLE_KEYS
WHERE TABLE_NAME = "tblEmp"
set @NextKey = @NextKey + 1

DECLARE tblNewEmp_cursor CURSOR FOR
select emp_pk from tblNewEmp

open tblNewEmp_cursor
FETCH NEXT FROM tblNewEmp_cursor
WHILE @@FETCH_STATUS = 0
begin
update tblNewEmp
set emp_pk = @NextKey
set @NextKey = @NextKey + 1
FETCH NEXT FROM tblNewEmp_cursor
end

close tblNewEmp_cursor

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved