Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting records 2

Status
Not open for further replies.
Apr 27, 1999
705
0
0
US
Hello,

I'm trying to create a database where I need to display the records in order of appearance. For example, I'll have records 1-10 to display. The user will also need to insert a record between certain numbers, therefore the records will have to be reordered. Any help would be appreciated! Thanks.

Fengshui1998
 
hi there,

i think malcom has given us a great and efficient solution to reorder records.

i will just list it out once again for your reference.

declare @variable int
set @variable = 5
update project_fund_allocation
SET @variable = year = @variable + 1

The @variable will be the seed value from where you will have to re order and an aditional 'Where' condition should select the 'year' column conditionally. ie all records > than the newly inserted record seed.

 
I stuck this solution up the FAQ of the SQL Server forum, as it is a SQL Server specific solution. Your votes for it are welcome - I want to get the free dinner for two for highest rated FAQ!
cheers,
Malcolm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top