Is there a generic way to get sequence

Hey,
I need a counter that will not initialized when my sever restarted, so i decide to write sequence in the data base for this.
My question is there a generic (for any vendor) way to get next id?
Thank you

If all of the target databases supports transactions then it is possible
1. Create a table that holds sequence number
2. For each operation
....a. Start transaction
....b. Get row - only one exists. Hold unto value.
....c. Increment value
....d. Update row
....e. Commit transaction.
....f. Return value from step b.
3. Use index value in some other expression.
Some databases, with non-ANSI SQL code might allow step 2 to be handled as a single statement, thus no transaction is needed.
The above allows for sequential values.
You can find "guid" algorithms written in java. Those produce non-sequential values.
You can produce your own value that is sequential if you can make assumptions about the enviroment that all of the systems will be running in by combining some or all of the following values.
- datetime
- ip
- process id
- static counter in application
- thread id

Similar Messages

Maybe you are looking for

  • CS3 (WIN) Cross referencing script

    Today I downloaded a cross-referencing script created by Teus do Jong, and I have found it to be of great use, but when it comes to using the script with linked and formatted copy (Word) and tables (Excel), it does not work (destinations are lost). I

  • Like columns in a newspaper

    I want to make a Report where on each page there are 3 columns. By columns I mean like columns in a newspaper. When it gets to the bottom of the page in the first column, it then goes to the top of the page in the second column, etc. How do I structu

  • Portal URL Alias creation

    i need info on how to setup aliases on portal systems For ex: http://<hostname>:<portnumber>/irj/portal  can be called as abc instead of complete url the user just type abc in the browser. i know how to setup system aliases but i need help on setting

  • Can't get home videos imported into iTunes?

    iTunes will let me import videos but then they are not there? And ideas on how to help? Thanks

  • Timing Comparison PS vs ACR

    I am noticing this in the past week or so, right after, it seems, the installation of SP3 for XP Pro. When sharpening using Smart Sharp, a 50M file is taking 4+ minutes but sharpening the same file in ACR takes about 11 seconds after the Open button