EchoFool Posted March 1, 2008 Share Posted March 1, 2008 Hey, i need help with a table i am using for trade system.. I want to put a "ID" field but i need it to be blank for a while until a certain event, then i need it to insert a unique ID. So it acts as a primary key. But i can't set it as primary key because there could be many rows set to "0" for a while before the field has been updated to a unique ID.... how can i get it to act only as a primary key once a value in a different field equals something? I have a table like this just so you can get what i mean: UserID | RequestID | Wait | RecordID | Now the "UserID" requests to a user on the site .. that user goes in RequestID. Then Wait is a field to tell the user what the situation is. So if Wait is changed to '1' from '0' then the RequestID user has accepted "UserID"s offer. At that point when the user "accepts" the request, that is when i need to insert a RecordID. That recordID is like a unique token to represent the ID of the transaction that they are both going to do but it must be unique every time. This is why i put primary key at first but then realized if i do that they can't all have 0 before hand, because it has to be unique when primary key... Any one got any suggestions on how I should do this without the risk of 2 transactions having the same ID? Quote Link to comment Share on other sites More sharing options...
werty37 Posted March 1, 2008 Share Posted March 1, 2008 Hi I guess you might have to change your logic a bit. You can create a temp table to hold the values and then move the data to the actual "members" table once the userid is confirmed. Hope that helps Regards Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.