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)
 using INSERT command to add records at a specific location.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-07-02 : 07:25:10
Joel writes "Today is the first day i've ever used SQL Server so this might be really simple, but i've already created almost an entire dynamic website today using SQL Server 2000, so here it goes. Im passing SQL an Execute using PHP through ADO. I've done many queries and they all work fine. However, I have tables that include date columns that are displayed on a page using a loop. When i use the INSERT command to insert rows into my database, they always go to the bottom. This causes a problem because now that date (which is probably the newest) ends up at the bottom of the page. Is there any way around this?

Thanks,
Joel"

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2003-07-02 : 09:24:20
quote:
When i use the INSERT command to insert rows into my database, they always go to the bottom


No - SQL Server is a relational database, which means (among other things) that you are working with sets of data, not an ordered collection of rows. There is no "bottom", or "top", or anything else. If you want rows returned in a specific order, you must explicitly declare that intent through the use of an ORDER BY clause.

Jonathan
{0}
Go to Top of Page

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2003-07-02 : 09:37:36
Joel,

Perhaps you should add a CreationStamp column to your table and then sort by that column when you want to display the data. Descending order will display the most recent added data at the top of your list.




Go to Top of Page
   

- Advertisement -