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)
 How to delete a record from BOF and insert a record at EOF in SQL server usin ASP

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-01-12 : 08:40:34
Nagulmeera writes "Hell guru's

I am new in SQL Server I have faced problem in navigating through the record sets in table.

My problem is like this:

"I want to insert at most 10 records in a table .when the table fileed withe 10 records i want to delete the first record from the table and insert the record at the end of the table.
initailly the table contain Zero records .

the table after fileed with 10 records is like this

table name:tbl_status

Status
-------------
message1
message2
message3
message4
message5
message6
message7
message8
message9
message10

now i want to delete the message1 and insert a new message11,then the table should like this

Status
-------------
message2
message3
message4
message5
message6
message7
message8
message9
message10
message11

Please any body help me how can i write a query.I am developing a " ASP "application:
======
pleas ehelp me withe a sample code;

Thanks
Nagulmeera"

mikejohnson
Posting Yak Master

153 Posts

Posted - 2005-01-12 : 10:35:24
It would help if you had an auto generated id key or a date created field so it's easier to determine the first/last records. for example, if you had an id field, you could do something like this:

delete from status where id=min(id)

insert into status(field) values('message' + cast(max(id) as char(5))

i think that will work but i haven't tested so....
Go to Top of Page
   

- Advertisement -