|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
adding a incremental number
Hello,
I am working on a basic insert of data into a SQL2000 table, I am new to SQL and only know really basic things right now. The table has a number field that is not a identity field but the numbers must be uniqe. How do i use the number of the previous record to create the new number of the record i am inserting. Here is an example of the insert statement i have already: insert into T_eaddress ( eaddress_no, "This is the field that will hold the number" customer_no, eaddress_type, address, start_dt, primary_ind, inactive, market_ind, create_dt, html_ind ) select "this is where i need the function" epatron_pactpatronnum, '3', epatron_email, epatron_bademaildate, 'n', epatron_activee, 'y', getdate(), 'y' from e_patron inner join t_eaddress on e_patron.epatron_pactpatronnum = t_eaddress.customer_no Any insight would be great. Thanks |
|
#2
|
|||
|
|||
|
Why not define that number as an identity field? If you cannot do that, consider making the field a timestamp value.
Phil J.
__________________
...because that is the way we have always done it. We've been doing it like that for 80 Years! (How do we change that mindset?) |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > adding a incremental number |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|