ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elmer Smith" <esm...@venterraliving.com>
Subject Using SCOPE_IDENTITY() with MS SQL Server returns NULL
Date Thu, 04 Dec 2008 20:53:58 GMT
Hi all,

 

I am using MS SQL Server 2005, iBATIS 2.3.4 (and iBATOR 1.1.0), and JTDS
1.2.2.

 

I am using the <generatedKey> element to handle new IDs.  I consistently
get a NULL return with the sqlStatement="SELECT SCOPE_IDENTITY()".  If I
execute the same insert statement and SELECT SCOPE_IDENTITY() statement
in the SQL Server management tool, I get the ID with no problem.  Also,
if I change it to be sqlStatement="SELECT @@IDENTITY" or
sqlStatement="SELECT IDENT_CURRENT('table_name')" it returns the key
through iBATIS.  Any idea what could cause this?  I was using the MS
JDBC driver, but have switched now to JTDS hoping it would fix this.

 

Thanks in advance,

Elmer Smith

This message (including any attachments) is intended only for the use of
the individual or entity to whom it is addressed and may contain
information that is non-public, proprietary, privileged, confidential,
and exempt from disclosure under applicable law or may constitute
attorney work product. If you are not the intended recipient, you are
hereby notified that any use, dissemination, distribution, or copying of
this communication is strictly prohibited. If you have received this
communication in error, please notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this message
immediately if an electronic communication. 


This message (including any attachments) is intended only for the use of the individual or
entity to whom it is addressed and may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under applicable law or may constitute
attorney work product. If you are not the intended recipient, you are hereby notified that
any use, dissemination, distribution, or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify us immediately by telephone
and (i) destroy this message if a facsimile or (ii) delete this message immediately if an
electronic communication.


Mime
View raw message