Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Table Reverse

Author  Topic 

craigh999
Starting Member

10 Posts

Posted - 2004-07-23 : 04:22:54
Hi

I have an exisitng access database, and want to completetley reverse the records i.e. record 1 in record last position. Is there an easy way of doing this without having to write a query to one by one from the end then turn it back into the table hence givign me what i want?

Sorry if that is confusing?!?!?!

Many Thanks

Kristen
Test

22859 Posts

Posted - 2004-07-23 : 04:53:31
ORDER BY MyColumn DESCENDING ??

Kristen
Go to Top of Page

craigh999
Starting Member

10 Posts

Posted - 2004-07-23 : 05:10:14
I think you miss my point, the db gets passed to a machine for production so i sctually need to physically reverse the record positions i.e. the first record has to be the last one

Many Thanks
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2004-07-23 : 05:46:04
it'll help if you can give us sample data to 'enlighten' us....your original description is too vague for strangers to conjure up the problem without something tanglible to hold onto.
Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2004-07-23 : 05:47:02
What do you mean?

Show us an example.

-------
Moo. :)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-23 : 06:02:53
Is there such a thing as physical order in Access then? I'm used to databases storing the records in whatever order they see fit and only giving them to me in a "repeatable" order if I use an ORDER BY

Kristen
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-07-23 : 10:08:55
No order of data in a database, even access, is meaningless...ok except oracle....but even then, when the data is reorganized, I believe it is still meaning less...

Actually worse then that if you decide to store Oracle Rids as a pointer....



Brett

8-)
Go to Top of Page

craigh999
Starting Member

10 Posts

Posted - 2004-07-23 : 10:31:07
Its ok good round it a different way, actually the order with what we are doing is paramont, the machine using it knows nothing of sql statements (i.e. Order by). What i wanted was an easy way to just swap physically all the records round. Instead gone back to the app and just used innerlist.reverse of a collection class

Many Thanks Though
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-07-23 : 10:39:06
quote:
Originally posted by craigh999

Its ok good round it a different way, actually the order with what we are doing is paramont, the machine using it knows nothing of sql statements (i.e. Order by). What i wanted was an easy way to just swap physically all the records round. Instead gone back to the app and just used innerlist.reverse of a collection class

Many Thanks Though



Are we talking about a database or an app interface?

To "order" data in a database, you would need a coulumn that signifies that...



Brett

8-)
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2004-07-23 : 11:31:11
quote:
Originally posted by X002548

No order of data in a database, even access, is meaningless...ok except oracle....but even then, when the data is reorganized, I



What do you mean?. Data order in Oracle is also meaningless.



-ec
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-07-23 : 12:43:22
Would you store Rownum for future reference?

It's only relevant to the result set of that time and place...

Ok, now RowId...Would you store that? What happens when you reorg the tablespace?



Brett

8-)
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-07-23 : 12:46:16
Put a clustered index on the table and use DESC. That'll reverse the order.

Tara
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2004-07-23 : 13:11:19
quote:
Originally posted by tduggan

Put a clustered index on the table and use DESC. That'll reverse the order.

Tara



I think the original question was for an access database.



-ec
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2004-07-23 : 13:13:45
quote:
Originally posted by X002548

Would you store Rownum for future reference?
Ok, now RowId...Would you store that? What happens when you reorg the tablespace?



Rowid would definitely change. That is because ROWID actually means something, it is the physical location where your data is located. It also happens to be unique. You would never store it, or use it for an FK or something of that sort.



-ec
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-07-23 : 13:15:02
quote:
Originally posted by eyechart

quote:
Originally posted by tduggan

Put a clustered index on the table and use DESC. That'll reverse the order.

Tara



I think the original question was for an access database.



-ec



So Access doesn't have a clustered index option?

Tara
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2004-07-23 : 13:16:23
quote:
Originally posted by tduggan
So Access doesn't have a clustered index option?

Tara



shows you how much I know about access!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-07-23 : 13:18:36
Well I don't know Access either, but I assumed that it did.

Tara
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-23 : 13:38:07
You'll be looking for the Upsize Wizard from SQL to Access next. Dear oh dear oh dear.

Kristen
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-07-23 : 13:43:23
I'm not sure of the verbage, but the concept is definetly is...



Brett

8-)
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2004-07-23 : 22:52:35
If you can't do a select then what about creating a new table in the access database and do a
INSERT INTO newTable
SELECT * FROM oldTable ORDER BY Something
Go to Top of Page
   

- Advertisement -