试试NEWID ( ),不过类型必须是uniqueidentifier

解决方案 »

  1.   

    用这个也可以::-)@@IDENTITY
    Returns the last-inserted identity value.Syntax
    @@IDENTITYReturn Types
    numericExamples
    This example inserts a row into a table with an identity column and uses @@IDENTITY to display the identity value used in the new row.INSERT INTO jobs (job_desc,min_lvl,max_lvl)
    VALUES ('Accountant',12,125)
    SELECT @@IDENTITY AS 'Identity'
      

  2.   

    在你的weblogic-cmp-rdbms-jar.xml中应该这样写:
        <automatic-key-generation>
          <generator-type>SQL_SERVER</generator-type>
        </automatic-key-generation>
    并且,在create方法中不能有主键参数出现!搞定,有问题来信,
      

  3.   

    kexsong(大可) :发给我一个例子吧,多谢!
      

  4.   

    [email protected]
    如果大家能发个例子来,我一定把分奉上。
      

  5.   

    jdbc 3.0在insert以后可以查找生成的id
      

  6.   

    但是现在我只用jdbc2.0,那怎么办?