473,471 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Recordset's Order and Database's Physical Order?

Hi,guys!

I have a table below:
CREATE TABLE rsccategory
(
categoryid NUMERIC(2) IDENTITY(1,1),
categoryname VARCHAR(20) NOT NULL,
PRIMARY KEY(categoryid)
)
Then I do:
INSERT rsccategory(categoryname) VALUES('url')
INSERT rsccategory(categoryname) VALUES('document')
INSERT rsccategory(categoryname) VALUES('book')
INSERT rsccategory(categoryname) VALUES('software')
INSERT rsccategory(categoryname) VALUES('casus')
INSERT rsccategory(categoryname) VALUES('project')
INSERT rsccategory(categoryname) VALUES('disert')
Then SELECT * FROM rsccategory in ,I can get a recordeset with the
'categoryid' in order(1,2,3,4,5,6,7)
But If I change the table definition this way:
categoryname VARCHAR(20) NOT NULL UNIQUE,
The select result is in this order (3,5,7,2,6,4,1),and 'categoryname '
in alphabetic.
Q:why the recordset's order is not the same as the first time since
'categoryid' is clustered indexed.

If I change the table definition again:
categoryname VARCHAR(20) NOT NULL UNIQUE CLUSTERED
the result is the same as the first time.
Q:'categoryname' is clustered indexed this time,why isn't in alphabetic
order?

I am a newbie in ms-sqlserver,or actually in database,and I do have
sought for the answer for some time,but more confused,Thanks for your
kind help in advance!

Jul 20 '05 #1
2 2726
I assume the last post was a mistake or a late delivery from a news server, as you've got several
replies to your question. If you have question on any of the replies, please ask along with the
reply (and not just post the question again).

--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as ugroup=microsoft.public.sqlserver
"Rhett Liu" <li**********@mail.biti.edu.cn> wrote in message news:bi**********@mail.cn99.com...
Hi,guys!

I have a table below:
CREATE TABLE rsccategory
(
categoryid NUMERIC(2) IDENTITY(1,1),
categoryname VARCHAR(20) NOT NULL,
PRIMARY KEY(categoryid)
)
Then I do:
INSERT rsccategory(categoryname) VALUES('url')
INSERT rsccategory(categoryname) VALUES('document')
INSERT rsccategory(categoryname) VALUES('book')
INSERT rsccategory(categoryname) VALUES('software')
INSERT rsccategory(categoryname) VALUES('casus')
INSERT rsccategory(categoryname) VALUES('project')
INSERT rsccategory(categoryname) VALUES('disert')
Then SELECT * FROM rsccategory in ,I can get a recordeset with the
'categoryid' in order(1,2,3,4,5,6,7)
But If I change the table definition this way:
categoryname VARCHAR(20) NOT NULL UNIQUE,
The select result is in this order (3,5,7,2,6,4,1),and 'categoryname '
in alphabetic.
Q:why the recordset's order is not the same as the first time since
'categoryid' is clustered indexed.

If I change the table definition again:
categoryname VARCHAR(20) NOT NULL UNIQUE CLUSTERED
the result is the same as the first time.
Q:'categoryname' is clustered indexed this time,why isn't in alphabetic
order?

I am a newbie in ms-sqlserver,or actually in database,and I do have
sought for the answer for some time,but more confused,Thanks for your
kind help in advance!

Jul 20 '05 #2
Tibor Karaszi дµÀ:
I assume the last post was a mistake or a late delivery from a news server, as you've got several
replies to your question. If you have question on any of the replies, please ask along with the
reply (and not just post the question again).

late delivery,
you are right,
And you are so kind!Wishes!

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Grahammer | last post by:
For some reason I am getting an error when trying to open a recordset on an Access database on my Win2K3 machine from my INDEX.ASP page, but the same code accesses the database fine when coming...
23
by: Rob Meade | last post by:
Lo all, Ok - this is what I was aiming to do, and then I thought - naahhh, that cant be right! query database results to recordset results to array using GetRows update values in one column...
4
by: Tom | last post by:
I want to open a recordset object on an .asp page. When I open the recordset I would like to use a stored procedure that expects a parameter to be passed for the stored procedure. I will then use...
3
by: Tlm | last post by:
Hello All, I have a form (FrmA) with a subform (SubFrmB) embedded in it. SubFrmB also has a subform embedded in it (SubFrmC) The form's recordsource is based on a table (TblA). SubFrmB's...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
22
by: Gerry Abbott | last post by:
Hi all, I having some confusing effects with recordsets in a recent project. I created several recordsets, each set with the same number of records, and related with an index value. I create...
5
by: Henry Su | last post by:
Hello All, I am looking to whip a recordset out of thin air through a series of database record manipulation (so there is no physical equivalence to any database entities such as a table or...
1
by: Ray Holtz | last post by:
I have a database in Access 2003 (Access2000 file format). There are two tables that are being used: Employees and Items. It is linked by the Employee field so that one employee can have many...
0
by: solar | last post by:
I am creating a new recordset in 2 tables, orders and order details.Obviously i have to open the recordset for two tables.Shall i open the recordset for the table order details and when shall i...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.