473,405 Members | 2,287 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,405 software developers and data experts.

Increase last number used by 1

I have a list of order numbers and want to increase the last number used by 1 and store the latest number in a table.

Autonumber does not work for me as all the data is in a table already.

New to SQL so please help in non-technical (idiot way) explanation

thanks
Jul 26 '07 #1
4 3908
Twanne
65
Bit more explanation would be handy.

But I think what you want is to select the last number in your table and than increase it with one and then just write it back to the (or another) table.

There are sql functions wich let you return the first (or last if you change order) record from a table.

Greetz
Jul 26 '07 #2
Bit more explanation would be handy.

But I think what you want is to select the last number in your table and than increase it with one and then just write it back to the (or another) table.

There are sql functions wich let you return the first (or last if you change order) record from a table.

Greetz

Sorry

im trying to create an order book that takes the last order number used and then creates a new order number ie. last order number plus 1 .

This saves the order with that order number in a table and on a new order gives the new order the next order number.

The order number up to now has been a manual system, look back to the last order and add 1.

However as the table is in use I cant put an auto number on it.

thanks for any help

Tony
Jul 26 '07 #3
abolos
65
I have a list of order numbers and want to increase the last number used by 1 and store the latest number in a table.

Autonumber does not work for me as all the data is in a table already.

New to SQL so please help in non-technical (idiot way) explanation

thanks
You may try this:

Select MAX(field that has the number).....

This MAX will bring the last number in the order and then you can use the INSERT SQL command in order to insert it in another table.

abolos
Jul 26 '07 #4
missinglinq
3,532 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1. NewOrderNumber = DMax("[OrderNumberField]", "TableName") + 1
Welcome to TheScripts!

Linq ;0)>
Jul 26 '07 #5

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

Similar topics

5
by: Tony Clarke | last post by:
Hi, Background: I have written a Call Logging and Reporting System using PHP that integrates with an existing MS Access Database. The information in the database is all held in flat tables...
5
by: Olaf Gschweng | last post by:
We're new into DB2 and have some problem with DB2 8.1 (?) on a Linux system. We load some big tables of a DB2 database from files every day. We do a "DELETE FROM table" for each table and then we...
2
by: a.p.mews | last post by:
Hi I'm trying to build a database to hold a CD collection inputting to a Form. I enter the CD number - no problem there, but would then like to enter a track number AND increase that number...
2
by: special10101 | last post by:
The Immigration Bill being sent to reconciliation includes the following: 1) Doubling the current number of H1-B visas from 65,000/year to 115,000/year. 2) Every year that the number of visas...
5
by: ipy2006 | last post by:
Hi All: In the table XYZ.ORD_DTL the column PDT_DESC is CHAR(35). I want to increase it to CHAR(100). However, I am getting the following error. Please help! db2 =alter table XYZ.ORD_DTL alter...
5
by: RThaden | last post by:
Hi all, I have a text file with a list of MAC addresses. Each time, my program is called it reads the last MAC address entry from the file, increases it by one, writes this new address into a 6...
4
by: =?Utf-8?B?c2FtZWVy?= | last post by:
environment : .net framework 1.1, ado.net, visual studio 2003, vb, sqlsever 2000, winforms, webforms I want to increase the timout of the webservice in the application which is being used in a...
3
by: thebuzzman | last post by:
I started a database for entering ambulance run reports last month. So far, everything is going great with it. As expected, I am always trying to improve upon it as I learn more things. What I...
3
by: sheldonlg | last post by:
What is happening here. It seems that there is about a 100-fold increase in the spam messages appearing here compared to just a few months ago. Is there a way for the server(s) to filter out the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.