Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 24th, 2011, 06:57 AM
Authorized User
 
Join Date: Apr 2008
Posts: 35
Thanks: 1
Thanked 0 Times in 0 Posts
Default Updating an Order Column

I have a table which contains a column for the record display order, for example a list of menu items:

Code:
ID  OPTION  ORDER_INDEX
--  ------  -----------
 1  Opt1    10
 2  Opt3    30
 3  Opt2    20
This is then called with "SELECT OPTION FROM OPTIONS_TABLE ORDER BY ORDER_INDEX" and what I am trying to do is put a TRIGGER AFTER INSERT/UPDATE on the table, so that if someone adds a new entry with an ORDER_INDEX that's not a multiple of 10 or that the ORDER_INDEX is NULL then the table will maintain itself

Hope that makes sense and hope someone can help me

I am using SQL2008, btw
__________________
Regards,

Sean





Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating products quantity when order item insert Tawanda BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 June 7th, 2007 02:30 PM
Rearrange the column order in a datatable/dataset kiran_q8 ASP.NET 2.0 Professional 2 May 3rd, 2007 08:46 AM
Column Order busher ASP.NET 1.0 and 1.1 Basics 11 August 6th, 2005 12:44 PM
ORDER BY a column? gilgalbiblewheel Classic ASP Databases 1 March 30th, 2005 10:37 AM
updating unit_in_stock column after order olambe SQL Server 2000 7 June 7th, 2004 04:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.