all groups > sql server (alternate) > august 2003 >
You're in the

sql server (alternate)

group:

Recordset's Order and Database's Physical Order?


Re: Recordset's Order and Database's Physical Order? Tibor Karaszi
8/28/2003 4:07:13 PM
sql server (alternate):
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


[quoted text, click to view]

Recordset's Order and Database's Physical Order? Rhett Liu
8/28/2003 9:17:08 PM
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!


Re: Recordset's Order and Database's Physical Order? Rhett Liu
8/29/2003 7:58:31 AM
Tibor Karaszi дµÀ:
[quoted text, click to view]
late delivery,
you are right,
And you are so kind!Wishes!
AddThis Social Bookmark Button