damian
Posts: 838
|
| Posted: 07/05/2009, 6:41 AM |
|
is there a good way to autoincrement a table id by more than 1 each time? i am using mysql 4.x on a shared server....
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/05/2009, 9:14 AM |
|
No way I know of at table creation for auto increment.
If you do not mind extra MySql queries, You could write code to do this for you depending on your requirements for this.
What is your requirement here? Why do you need this feature?
Let me know. Maybe there is a better way to accomplish your requirement.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/05/2009, 9:26 AM |
|
Maybe try in your table definitions something like this. But am not sure they will work or will work in Mysql 4.x
CREATE TABLE `invoices_offset_increment` (
`invoiceId` int(11) NOT NULL AUTO_INCREMENT AUTO_INCREMENT_INCREMENT = X,
`customerId` int(11) NOT NULL,
`notes` varchar(250) NOT NULL,
`createdDate` datetime NOT NULL,
PRIMARY KEY (`invoiceId`)
);
or
CREATE TABLE `invoices_offset_increment` (
`invoiceId` int(11) NOT NULL AUTO_INCREMENT_INCREMENT = X,
`customerId` int(11) NOT NULL,
`notes` varchar(250) NOT NULL,
`createdDate` datetime NOT NULL,
PRIMARY KEY (`invoiceId`)
);
Where X in the AUTO_INCREMENT_INCREMENT is your increment value
Let me know if something like that works
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
damian
Posts: 838
|
| Posted: 07/05/2009, 3:44 PM |
|
the AUTO_INCREMENT AUTO_INCREMENT_INCREMENT = X was introduced in 5. something
A customer has a complex EXCEL form that they use to track and calculate a whole stack of stuff. They have contractors that do work and provide updates. These updates are entered into the EXCEL. They dont let the contractors do it because they dont want them seeing other info on the form, the contractors are in multiple locations and we dont want people locking the file open and walking away...
So I created a database backend and an ODBC connector to pull the data which looks like it will work. I also have v1 of the web front end created so that the contractors can update their info and only their info - it also doesnt matter how many try to do it simultaneously. The Excel can be updated as often as required - just click Refresh Data.
Now the reason for incrementing by 2 (and in fact I havent even checked if this will create a blank line... ) is that the job has 2 contractors and in the excel the 1st line contains all the info + the first contractor while the second line only has second contractors details completed - this is where they are calculating how much they get paid....
i had better go back and test this line creation thingy first....
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/05/2009, 6:53 PM |
|
K
Let me know.
Did your other issue get solved for that session question?
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
damian
Posts: 838
|
| Posted: 07/05/2009, 7:22 PM |
|
John - im sure that your solution will work for my other issue but wont be trying it for another couple of hours....
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/05/2009, 8:41 PM |
|
Damian
Did you line creation thingy work?
Am I correct is assuming that when you get ready to add a new transaction for a thing you are creating 2 records, one for contrcator 1 and 1 for contractor 2?
Then each contractor updates his record for that transaction?
I am not sure I understand here.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |