ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Drouin.Mathieu" <Mathieu.Dro...@cic.gc.ca>
Subject selectKey on Sybase
Date Thu, 29 Dec 2005 17:05:23 GMT
Hi,
 
I have a strange problem....I've been moving our code from SQL Server to
Sybase and I have encountered the following problem....
 
In one of my insert statements...the SELECT @@IDENTITY returns 0 instead
of the desired value....
 
example....
 
<insert id="insertSample" 
          parameterClass="SampleClass">
    <![CDATA[       
    INSERT INTO sample_t(
      col1
    , col2
    , col3
    ) VALUES (
      #val1#
     ,#val2#
     ,#val3#
    ) 
    ]]>
  <selectKey resultClass="int" keyProperty="id" >
      SELECT @@IDENTITY AS value
  </selectKey>   
  </insert>
 
However, I've been running some unit tests and I have found a nearly
identical statement elsewhere which returns a correct value (using
Sybase)...
 
I'm baffled....Everything used to work just fine under SQL Server....
 
Mat 

Mime
View raw message