How can I make an insert do the insert on the last row? Because I notice on my table that when I do an insert it insert the data randomly. Do i need to change some properties on the SQL?
What you need to understand (and get comfortable with) is the fact that the physical ordering of the rows is NOT important and should not be important.
Whenever you display the data to the user in a grid type of format, you should ALWAYS include an order by (so that the rows appear in the order that makes sense for the display).
-George
Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
Relational tables and views are unordered sets by definition. Yes, you can put a clustered index on your table and the data will be physically ordered. But, that still does not mean that the data is guaranteed to be returned in that order. There are a number of reasons including cache hits, parallelism and such, but that is beyond the scope right now. As mentioned by gmmastros, the only way to guarantee the order of a select is to order by what ever column(s) you want.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.