October 8, 2001 at 6:26 am
Hi,
This query below is intended to generate a new table ordered on its EmployeeID column.
SELECT * INTO db1..test1
FROM db2..Orders
ORDER BY [EmployeeID]
However, it generates a table where the first fith (consistently!) is actually the last fifth??? e.g. on my particular base table it orders the new table like such:
_EmployeeID values______Rows
_8-9___________________1-160
_1-7___________________160 - 860
Does anyone know why this might be happening??
Alan.
P.S. I am doing this on the Northwind Orders table
October 8, 2001 at 8:12 am
Selects have no guaranteed order - you're going to have to use the order by in your second select to get the results you want.
Andy
October 8, 2001 at 8:54 am
Hi Andy
I have no second select, the actual data that this will be performed on is 800,000 records long. Therfore i return a reference to the test1 tables location, so the client application can connect to the test1 table and retrieve 50 rows at a time for display (using ADO.NET).
Any ideas ???
October 8, 2001 at 9:11 am
You're not doing a select from the test1 table? I would think that this is an expensive method of doing paging - I'd at least consider just inserting the primarykey into test1 and using that to select your records from your main table.
If you look at the articles by Jon Winer he has covered some ideas recently about returning a subset of a recordset.
Andy
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply