If you're using SQL Server, you might put something together using table variables:
declare @t table ( > thisrow int identity, > x varchar(100), > y varchar(100) > ) > > insert into @t ( x, y ) > select x, y from yourtable > > select * from @t > -- Ken On 12/15/06, Duane <[EMAIL PROTECTED]> wrote: > > I hadn't thought of a trigger, but that would work. > > Thanks, > Duane > > -----Original Message----- > From: Teddy Payne [mailto:[EMAIL PROTECTED] > Sent: Friday, December 15, 2006 4:09 PM > To: SQL > Subject: Re: row index > > Have you thought of creating an insert trigger that would get the max > ordinal value and then increment it by one into the new row? > > Teddy > > > On 12/15/06, Duane <[EMAIL PROTECTED]> wrote: > > > > I have that. Tables look like: > > > > Conference: > > ConfID > > Title > > > > Hotel: > > HotelID > > Title > > > > ConferenceHotelXRef > > ConfID > > HotelID > > OrderNum > > > > > > Duane > > > > > > -----Original Message----- > > From: Teddy Payne [mailto:[EMAIL PROTECTED] > > Sent: Friday, December 15, 2006 3:48 PM > > To: SQL > > Subject: Re: row index > > > > Do you have the ability to change the database schema? I typically add > an > > ordinal value. It just contains the order of the display in an integer > > field. > > > > Teddy > > > > > > On 12/15/06, Duane <[EMAIL PROTECTED]> wrote: > > > > > > Neither. > > > > > > I have a form that inserts a record (conference). Each conference can > > have > > > up to two hotels which the user can create while on the main form via > > > popup. > > > When the user enters the hotel info I store the hotelID on the main > form > > > using JavaScript. > > > > > > When the conference record is submitted to the database and the insert > > > occurs, I then update a crosslink table that joins the two tables > > > together, > > > but I want the record to store the order in which they were inserted > > > because > > > that determines the display order on the conference page. I need to do > > > this > > > in a stored proc as I can not have straight SQL in my code. > > > > > > Thanks, > > > Duane > > > > > > > > > > > > -----Original Message----- > > > From: Teddy Payne [mailto:[EMAIL PROTECTED] > > > Sent: Friday, December 15, 2006 3:07 PM > > > To: SQL > > > Subject: Re: row index > > > > > > Are you performing bulk inserts or looping over inserts? > > > > > > Teddy > > > > > > On 12/15/06, Duane <[EMAIL PROTECTED]> wrote: > > > > > > > > Within a table > > > > > > > > Something like: > > > > > > > > Select x, y, currentrow > > > > From table > > > > Where z = @a > > > > > > > > > > > > I'm doing an insert into a table and I would like to track the order > > in > > > > which the data is inserted. Like so: > > > > > > > > Insert dbo.table (a, b, displayOrder) > > > > Select x, y, currentRow > > > > From table2 > > > > Where table2.id = c > > > > > > > > > > > > > > > > > > > > -----Original Message----- > > > > From: Robertson-Ravo, Neil (RX) > > > > [mailto:[EMAIL PROTECTED] > > > > Sent: Friday, December 15, 2006 2:41 PM > > > > To: SQL > > > > Subject: Re: row index > > > > > > > > Row within a resultset (ColdFusion) or a row within a table? > > > > > > > > > > > > -----Original Message----- > > > > From: Duane > > > > To: SQL > > > > Sent: Fri Dec 15 18:47:40 2006 > > > > Subject: row index > > > > > > > > Is there a way within SQL to get the current row index from a query? > > > > > > > > Thanks, > > > > Duane > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2673 Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6
