[dba-SQLServer]Sorting order when exporting

Wortz, Charles CWortz at tea.state.tx.us
Fri Jun 13 07:41:34 CDT 2003


David,

In a relational database such as the Jet engine or SQL Server, tables
are sets of records that have no natural order since there is no
relationship between the physical and logical location of a record
within a table.  Thus, there is no such concept of "correct order."  If
the table has a primary key then when you open the table the records
will be displayed sorted by PK.  That is all you need.

Charles Wortz
Software Development Division
Texas Education Agency
1701 N. Congress Ave
Austin, TX 78701-1494
512-463-9493
CWortz at tea.state.tx.us



-----Original Message-----
From: David Emerson [mailto:davide at dalyn.co.nz] 
Sent: Thursday 2003 Jun 12 22:22
To: dba-SQLServer at databaseadvisors.com
Subject: [dba-SQLServer]Sorting order when exporting


AXP ADP, SQL2000.

When I use a SELECT sproc to export to an excel spreadsheet the records 
appear in a sorted order -

DoCmd.OutputTo acOutputStoredProcedure, strSprocName, acFormatXLS,
strFullName

However, if I use the same sproc as the basis for an INSERT INTO
statement 
that inserts the records into a table, I find that the records are no 
longer appearing in their sorted order.

Is this a feature of  Access/SQL or is there a way for the records to be

sorted  in the correct order as they are inserted into the table?

Regards

David Emerson
DALYN Software Ltd
25b Cunliffe St, Johnsonville
Wellington, New Zealand
Ph/Fax (877) 456-1205 


More information about the dba-SQLServer mailing list