Utilizing auto-increment/identity fields for primary key with "application" identity

Is it possible to utilise an auto-increment (identity in MS SQL Server)
field for the primary key field when using "application" identity?

To the best of my knowledge, you cannot use auto-increment. Due to the
differences in the way that identities are generated at the datastore
(upon insert) vs. JDO (upon makePersistent), this feature of SQLServer is
not supported yet.
However, we do provide a variety of other ways of generating identity
which may provide a closer fit to what you want, and
our users may have some experience in solving your problem.
On Tue, 28 Jan 2003 09:56:08 +0000, Sean Ryan wrote:
Is it possible to utilise an auto-increment (identity in MS SQL Server)
field for the primary key field when using "application" identity?--
Stephen Kim
[email protected]
SolarMetric, Inc.
http://www.solarmetric.com

Similar Messages

  • How can I create an auto-incrementing ID field for a web app?

    I have a web app for a project database. Customers can login and add a new record to the web app. We need it to provide each new project with a unique and sequential number. The BC ID number for each web app item is unique but of course not sequential (and too long). So for example the client would like all project IDs to be 4 digits starting from 1000. Any ideas?
    Thanks in advance!

    Kapowaz,
    Just thinking out loud, I wonder if you could use an Automator action to find the last invoice created and open a new file with a name based on incrementing a part of last file's filename. This would make the filename the same as the invoice number and you would still have to transfer the file's name to the content of the file.
    If I had this need, I think I would create an Invoice Log document. It would be easy to have a table into which you would enter identifying data and date and have the table generate a new invoice number that you could paste into the current invoice document. It would kill two birds with one stone if you need an index of your invoices.
    Jerry

  • Adding 2 new fields as Primary Key field in a Z Table which is existing PRD

    Hi Friends,
    I have to add two new fields as primary key fields in a Z TABLE, which is existing in Quality and Production Systems with Data.
    If I incorporate these two new fields (Primary Key fields) in development and if the TR is moved to Quality and Production sytems, is there any possibility of loss in data will happen at Quality and Prd systems?
    At present, Table is having 20 fields with 2 primary key fields and i have to add 2 more primary key fields.
    I have checked in SCN and not find relevant threads.
    Please help me out.
    Regards,
    Suresh.

    NO . It wont be a problem .
    For ex :
    If you have VBELN  , POSNR are key fields now , you have an unique reord with that combination .
    If you add one other field in it  fo ex  VKBUR  then records will be like this
    VBELN     POSNR     VKBUR   MATERIAL   QTY
    10020      10                            abcxyz      1
    10020      10            1234        abcxyz     1
    So your previous records before adding new primary keys , will have new fields balnk , and the new records will have data filled up in all primary key fields .
    However , if you try to update the existing records that will be in existing PRIMARYKEY combination only .
    for example if you try update record 1 above with VKBUR value 85858 , it creates a new record , it wont be updated in existing record.
    Hope this helps , Pls let me know if u have any more doubts.

  • Order of fields in Primary key in where clause

    Hello,
    Does order of fields(complete primary key) in where condition matters with the performance or using of index ?
    Here is an example -
    BKPF has primary key - bukrs, gjahr, belnr.
    1. select single awkey into lv_awkey
      from bkpf where bukrs = p_bukrs
                  and gjahr = p_gjahr
                  and belnr = p_belnr.
    2. select single awkey into lv_awkey from bkpf
                                  where bukrs = p_bukrs and
                                            belnr = p_belnr and
                                            gjahr = p_gjahr.
    Does it make any difference in performance point of view with above two kinds ? Is that same applicable when accessing based on secondary index ?
    Thanks,
    Nagarjuna

    Hi Nagarjuna,
    the order of the fields does not influence the performance of the execution of the statements. This is true for primary key and secondary key accesses. In the statement cache (SAP and DB) two different statemens have to be maintained (parsing, space, ...) but their execution time is the same.
    Kind regards,
    Hermann

  • How to Alter any table to make some fields Composite Primary Key

    I need to Alter Table to make some fields Composite Primary Key.
    Is it possible to do this ?
    Please give any example.
    Regards,
    AgrawalV

    Agrawal
    If you are looking for an example to create a composite primary key, here you are.
    sql> Alter Table myTable add constraint pk_myTable primary key(col1, col2, ...coln) ;
    where
    pk_myTable is the name of the primary key constraint,
    myTable is the name of the table that you want to create a constraint on and
    col1...coln are the column names in the table <myTable)

  • Propagate Properties option for Primary Keys?

    Hi,
    I have a physical model Oracle Database 11g created. I would like to change Using Index option from one value to another for most of primary keys in the model. Is there a way to do it? Additionally I would like to assign all primary key indexes to one tablespace.
    Now, I have to:
    1. Double click on one of the primary keys.
    2. Change Using Index option on General tab.
    3. Go to Using Index tab and select proper tablespace.
    All these steps have to be repeated for each primary key.
    Is there a way to do it once and propagate the change for all? There is similar option on indexes but I don't see it for primary keys.
    Arek

    Hi Arek,
    unfortunately there is no "Propagate Properties" functionality for primary keys.
    Philip

  • Using CMR field as Primary Key in Entity Bean

    Hi, all!
    Can somebody tell me, is it possible to use CMR field as Primary Key field in Entity Bean?
    Thanks

    WebLogic Server supports mapping a cmr field to the primary key.

  • Profit Center as mandatory field for Posting keys 01, 11, 31, etc.

    Hello,
    Currently I am in a project in which we have implemente New GL; my client is asking me to activate the Profit Center field for posting keys 01, 11, 21 and 31, so they can post in example documents with posting key 31 (vendor) vs posting key 01 (client). I modified the accounts field status in order for the Profit Center to be mandatory. I modified, as well, posting keys 01, 11, 21 and 31 field status' in orden for the profit center to be mandatory as well. Regardless of this, the profit center just doesn't appear when I post a document in example through tx F-02.
    Does anyone knows how to make this field appear for the posting keay I mentioned? Is it possible? or is this a system limitation?
    Thanks in advance for your help.
    Regards,
    HP

    Hello,
    I figured out how to make the Profit Center field modifiable on the Client and Vendor postitions.
    Thanks to everyone for their replies.
    Regards,
    Paul

  • Updating primary key with jdbc

    Trying to update a primary key with:
    public static void updateTAXID(String coid,String accountnumber,String oldTAXID,String fundname,String newTAXID){ Properties props = TradeHelper.loadProperties(); Connection conn = null; PreparedStatement st = null; String sql ="update FinancialAccount set taxid=? " + "where dealernumber=? and " + "taxid=? and " + "fundname=? and " + "accountnumber=?"; try{ Class.forName(props.getProperty("driver")); conn = DriverManager.getConnection(props.getProperty("brokerageurl"), props.getProperty("user"),props.getProperty("password")); st = conn.prepareStatement(sql); st.setString(1, newTAXID); st.setString(2, coid); st.setString(3, oldTAXID); st.setString(4, fundname); st.setString(5, accountnumber); st.executeUpdate(); System.out.println("Update: new tx:"+newTAXID+":"+"Ol tx: "+oldTAXID+" act:"+accountnumber); conn.close(); st.close(); }catch(Exception e){ e.printStackTrace(); } }
    I keep getting this error:
    com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '02673025561-QA-SLFCA-' for key 'PRIMARY'         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1011)         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)         at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)         at com.mysql.jdbc.PreparedStatement.exe
    Am I not able to update a single field of a composit key with jdbc? Whay is my update failing telling that there is a duplicate when I am trying to update?

    iketurner wrote:
    I keep getting this error:
    com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '02673025561-QA-SLFCA-' for key 'PRIMARY'
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1011)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
    at com.mysql.jdbc.PreparedStatement.exeAm I not able to update a single field of a composit key with jdbc? Whay is my update failing telling that there is a duplicate when I am trying to update?If you take the error message at its word then the problem is not that you are not permitted to update a primary key but that the values you are trying to use is already in use.
    I'll leave it you DBA and/or Data Modeler/Architech to decide if it is a good idea to update the value or not.

  • Creating a primary key with the parallel option and the tablespace option

    I know I can create a unique index with these options and then make the primary key with the "using index" clause. anyway to do this and skip the create unique index and just create the primary key ?

    SQL> ALTER TABLE t
      2  ADD CONSTRAINT pk_t
      3  PRIMARY KEY (testcol)
      4  USING INDEX
      5  TABLESPACE example
      6  PARALLEL (DEGREE 2);
    PARALLEL (DEGREE 2)
    ERROR at line 6:
    ORA-03001: unimplemented featureYou can name the tablespace but you must do an alter index thereafter.

  • Primary Key With Four Column ,How to use that Column As Primary Key In Form

    Dear All,
    i have create composite Key as primary Key With Four Column .
    How can i use these column in Form With Report Page.
    How can i use these four Column as primary Key to Edit Record .
    How can i do this.
    Thanks
    Vedant

    wrap a view around your table with this bogus primary key. Use an instead of trigger to handle the inserts and updates. And then look at using surrogate keys to resolve these bad design issues...
    5 out of 4 people don't understand fractions.
    Thank you,
    Tony Miller
    Webster, TX

  • Suppress NetPrice field for POS created with info records

    Hi ,
    What is the BADI used for Suppressing NetPrice Field for POS created with Inforecords(ME21n and ME22N).
    I dont find any user exit for this, so please can anyone say me what is the Badi used to meet the requirement.
    Thanks in advance,
    Donlad

    Hi sanjay,
    Suppressing in the sense, no changes should be made to net price field.
    The netprice should be suppressed only when po is a Production Po(Identified by account assignemnet Cateogery 'P') and material  has an inforecord.
    for other orders(overhead/nonbillable) using a material has an existing inforecord , the netprice field should not be suppressed.
    Waiting for your respopnse.
    THanks,
    Donald

  • How add new field as primary key for existing table

    Hi,
    There is table with name REVIEWER_REUSE_EFFORT and the table has 8000 rows in it.
    Now the enhacement i must do on this table is there is no primary key on this table. so i must create a ID also add values to this table of ID
    Table structure is like this
    Create table REVIEWER_REUSE_EFFORT
    PRO_ID number,
    POBJ_ID number,
    TASK_ID number,
    POTENTIAL_EFFORT number,
    COMMENTS varchar2(1200),
    CREATED_BY varchar2(100),
    CREATION_DATE sysdate
    UPDATED_BY varchar2(1200),
    UPDATED_DATE sysdate
    Please suggest me how to add values in that 8000 rows
    Thanks
    Sudhir

    Hi,
    If you want to add a new column and update the new column with sequence of number
    alter table REVIEWER_REUSE_EFFORT add (ID number);
    update REVIEWER_REUSE_EFFORT  set ID=rownum;Regards,
    Prazy
    Edited by: Prazy on Jun 21, 2010 3:13 PM

  • Auto Increment ID Field Table in the Oracle Database (insert new record)

    I have been using the MySQL. And the ID field of the database table is AUTO INCREMENT. When I insert a new record into a database table, I can have a statement like:
       public void createThread( String receiver, String sender, String title,
                                 String lastPostMemberName, String threadTopic,
                                 String threadBody, Timestamp threadCreationDate,
                                 Timestamp threadLastPostDate, int threadType,
                                 int threadOption, int threadStatus, int threadViewCount,
                                 int threadReplyCount, int threadDuration )
                                 throws MessageDAOSysExceptionand I do not have to put the ID variable in the above method. The table will give the new record an ID number that is equivalent to the ID number of the last record plus one automatically.
    Now, I am inserting a new record into an Oracle database table. I am told that I cannot do what I am used to doing with the MySQL database.
    How do I revise the createThread method while I have no idea about what the next sequence number shall be?

    I am still very confused; in particular, the Java part. Let me try again.
    // This part is for the database table creation
    -- Component primary key sequence
    CREATE SEQUENCE dhsinfo_page_content_seq
        START WITH 0;
    -- Trigger for updating the Component primary key
    CREATE OR REPLACE TRIGGER DHSInfoPageContent_INSERT_TRIGGER
        BEFORE INSERT ON DHSInfoPageContent //DHSInfoPageContent is the table name
        FOR EACH ROW WHEN (new.ID IS NULL) // ID is the column name for auto increment
        BEGIN
            SELECT dhsinfo_page_content_seq.Nextval
            INTO :ID
            FROM DUAL;
        END;/I am uncertain what to do with my Java code. (I have been working with the MySQL. Changing to the Oracle makes me very confused.
       public void updateContent( int groupID, String pageName, int componentID,
                                  String content, Timestamp contentCreationDate )
                                   throws contentDAOSysException
       // The above Java statement does not have a value to insert into the ID column
       // in the DHSInfoPageContent table
          Connection conn = null;
          PreparedStatement stmt = null;
          // what to do with the INSERT INTO below.  Note the paramether ID.
          String insertSQL = "INSERT INTO DHSInfoPageContent( ID, GroupID, Name, ComponentID, Content, CreationDate ) VALUES (?, ?, ?, ?, ?, ?)";
          try
             conn = DBConnection.getDBConnection();
             stmt = conn.prepareStatement( insertSQL );
             stmt.setInt( 1, id ); // Is this Java statement redundant?
             stmt.setInt( 2, groupID );
             stmt.setString( 3, pageName );
             stmt.setInt( 4, componentID );
             stmt.setString( 5, content );
             stmt.setTimestamp( 6, contentCreationDate );
             stmt.executeUpdate();
           catch
           finally

  • Auto increment number field

    Hello,
    I would like to have a number field to be auto increment. Ho can I do that in Oracle must I use some code for it or can I make the field auto increment by itself.
    Thanks

    user3311314 wrote:
    Hello,
    I would like to have a number field to be auto increment. Ho can I do that in Oracle must I use some code for it or can I make the field auto increment by itself.
    ThanksIt's a long standing gripe of mine. You must use code, and the appropriate solution is a sequence and a trigger, eg
    SASH_CLIENT @ DB10G >create table t(
      2      id number not null primary key
      3  ,   c1 char(100));
    Table created.
    SASH_CLIENT @ DB10G >
    SASH_CLIENT @ DB10G >create sequence seq_t;
    Sequence created
    SASH_CLIENT @ DB10G >
    SASH_CLIENT @ DB10G >create or replace trigger bir_t
      2  before insert on t
      3  for each row
      4  begin
      5  select seq_t.nextval into :new.id from dual;
      6  end;
      7  /
    Trigger created.
    SASH_CLIENT @ DB10G >insert into t(c1) values ('row 1');
    1 row created.
    SASH_CLIENT @ DB10G >commit;
    Commit complete.
    SASH_CLIENT @ DB10G >select * from t;
            ID C1
             1 row 1I'd much prefer
    create table t (
       id number primary key default seq_t.nextval
    ,  c1 char(100));

Maybe you are looking for

  • Help. Scripts in Tools menu in Bridge have vanished

    I'm not sure if this is the appropriate forum to place this message, but I need some help, so here goes: I have CS2 installed on a G5 dual 2 Ghz, with 1 GB RAM. When in Bridge, under the Tools menu where there should be 3 submenus for Photoshop, Illu

  • Dw cs3: ho wto make rotating photo gallery

    I would like to make a photo gallery where the images change every few seconds. How can I do this in Dreamweaver CS3/ Please respond here email me at [email protected] since it is the fastest way to reach me.

  • Document size changes when creating pdf from jpeg

    When I create a pdf from a jpeg file, the document size increases considerably. The native jpeg was saved in the "save to web" feature in Photoshop. I cannot find settings in ImageReady or Acrobat to make my document the correct size. Any suggestions

  • Powerbook Surround Sound

    I use a powerbook connected via firewire to a Motu 828mkII (which then connects to my surround sound speakers) In Logic, I have no problem sending signal to different speakers in my surround sound set up. I am having problems with playing a DTS audio

  • Screen exit for ME21N/22N/23N

    Hi All. I have created all the subscreens available for enhancement MM06E005 (sub. scr. 0101, 0111, 0201, 0211, 0301 and 0311) , and have put a text inside each subscreen. All I want so far is to see this text in transactions ME21N/22N/23N, but I can