Screwed up order of data in SQL 6.5greenspun.com : LUSENET : SQL Server Database Administration : One Thread |
Hi there,In one of our Microsoft SQL 6.5 databases we have a table named IPList which contains IP numbers and usernames that are identified with those IP numbers. We also have an identity column named ID. My problem is that somehow the ordering of the rows got completely screwed up. The data is still fine, i.e. the correct ID is assigned to its corresponding IP number, but the ordering of the rows is wrong. How can I fix this so that the rows are ordered correctly again (i.e. the ID that is numbered 1 is the first row in the database, the ID numbered 2 is the second row, etc.)? Thanks a lot for your help!
Chris
-- Anonymous, June 22, 1999
Chris,A database table should be thought of as an unordered set. If you need the rows to be ordered, you can add "ORDER BY ID" to the end of your select statement.
Hope this helps,
Eric
-- Anonymous, June 22, 1999