Re: Can it be done in SQL
Posted in 1996
Topics: Stored Procedures & SPL
The syntax varies, but I think you want something like:
insert into table (line_no, col1, col2) as Select
max(line_no), val1, val2 from table
Toby Denbow wrote:
>
> I want to insert some rows into a detail table. The question is how can
> I, in SQL, create line numbers for the rows being inserted without
> hardcoding them?
> I could probalby do it with a stored procedure but would prefer using SQL.
>
> For example I want the_line_number to be incremented for each row os that
> line_no is a valid line_no.
>
> EXAMPLE:
> insert into line_no, col1, col2
> select the_line_number, table.col1, table.col2 from table where col2 = "a"
--
Nick
Computer Consultancy & Development "Does your computer need housekeeping"
UK & Ireland Brushtec Distributor http://worldemail.com/wetc/brushtec
(dealerships currently available)
mailto:upson@cableol.co.uk "Does bouncing count"