473,387 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

New Id Generation

21
Good Mornining

I was hoping someone could possilbe assist.

I have three Table

1 - Candidates, (Where New Candidates Will be entered)

2- Offer (Where successfull candidates has been appended - Or new Offer Created without being in the Candidates Table

3- Where successfull candidates and offer records has been appended But also new record can be created from this table.

I currently have the ID field for all three tables on Autonumber, But as not very wise desicion,

If my candidates get appended to the offer table And if a new offer has been generated, i might have duplicates etc...

I was wondering if someone could please just guide me in the right direction.

I was hoping that i could generate a id for all three tables from one location. Due to the fact that the records move around,

Is it possible to do that,

Maybe have a NewID table and when a new record is being generated, it gets one that is not yet in use.

I have to keep the tables seperate (Know it is best practice to keep them all in on, but with different status, but unfortunately cant)

Any adivise would be appreciated,
Aug 6 '08 #1
2 1502
NeoPa
32,556 Expert Mod 16PB
AutoNumber values cannot be transferred from one table to another anyway. Each table they are added to would create a new value for the record related to that table.

Yes, storing them all in a single table is the first piece of advice I would give. Assuming that is a no-go though, let's move on.

When adding a new record, include a short bit of code (or even logic in SQL) that finds the Max() of the existing records for the class you're interested in (that may be across more than one table), and handling the situation where none is found of course, and add 1.

If you need more precise help you will need to explain your situation a bit more clearly I'm afraid (be careful to express your ideas without contradictions).
Aug 6 '08 #2
natural
21
Thank you very much for the response, and my apologies for the vaugness.

So if I have a table called TblNewId
I will have 3 tables that will be looking at it.

TblCandidate
TblOffer
TblEmployee

All three would once "NewRecord had been Selected" Look at the table NewID and then make us of max +1

But what if tblCandidate used the last max


How would i achieve this, via a query..

Any assistance is greatly appreciated.
Aug 12 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
8
by: Max M | last post by:
Yesterday there was an article on Slashdot: http://books.slashdot.org/article.pl?sid=03/09/04/1415210&mode=flat&tid=108&tid=126&tid=156 It is about automatic code generation. I got interrested...
0
by: Rasmus Fogh | last post by:
Someone raised the question of automatic code generation a few weeks back. And yes, we (CCPN) are using automatic Python code generation in a major way. Basically we are making data models in...
8
by: | last post by:
Wel, I am rebuilding the VC# 2002 project that I have deployment problems with the 2003 version, hoping this solves the problems, but now I encounter this wierd bug??? If I have the project, and...
9
by: Hayato Iriumi | last post by:
Hello, I hear some hypes about creating code to generate C# or VB .NET code, that is, code generation (sounds straight forward enough). I haven't really seen how it's done in real world. I'm...
1
by: George Meng | last post by:
I want to evaluate some code generation tool for my company. Want to get some idea from you. The bottom line is I want to get a tool to generate both store procedure as well as business object...
3
by: Eddy Ilg | last post by:
Hi, I would like to suppress .pyc generation or have the .pyc generation in a speical seperate root (I found something about PYCROOT). Has this been implemented yet? Is there an environment...
31
by: eliben | last post by:
Hello, In a Python program I'm writing I need to dynamically generate functions and store them in a dict. eval() can't work for me because a function definition is a statement and not an...
4
by: Troels Arvin | last post by:
Hello, We have started planning our DB2 generation 8 -9.1/9.5 upgrades, as April 30 2009 is no longer distant future (ordinary support for DB2 generation 8 on Linux/Unix/Windows==LUW will end on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.