-
Just learning SQL Statements
I want to create a select statement to where I would take a field, find the last number that was added to this field and then increment it by 1 to give me the next number.
If I can get help on creating a select statement to find the last number that would help me so much.
SELECT T0.[SuppSerial] FROM OSRI T0
First this is the field name in [] and the table is the OSRI, any help would be great, thanks
-
If it is SQL Server you can recreate the table with the SuppSerial column defined as Identity and it will automatically increment when you insert data.
Otherwise, you need to get max value of column and add 1 every time you insert and it can cause locking issue.
-
If you looking for just autonumbering then check this article. You could use co-related subquery to generate unique serial numbers.
http://www.databasejournal.com/featu...ry-results.htm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|