Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / January 2005

Tip: Looking for answers? Try searching our database.

Identity values in dynamic SQL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Who.Really.Really.Cares@gmail.com - 28 Jan 2005 07:25 GMT
Hi!

In dynamic SQL I'm inserting a row to a table with an IDENTITY column.
How can I retrieve the generated identity value?

The statement "VALUES IDENTITY_VAL_LOCAL()" returns the following error
when I try to PREPARE it:
SQL0142N  The SQL statement is not supported.  SQLSTATE=42612
SQLSTATE 42612: The statement string is an SQL statement that is not
acceptable in the context in which it is presented.
Any ideas?

Thanks.

WhoReallyCares
Serge Rielau - 28 Jan 2005 11:45 GMT
> Hi!
>
[quoted text clipped - 11 lines]
>
> WhoReallyCares

VALUES returns a table. Depending on your interface you may need to open
a cursor. Some interfaces actuallt have a function to return identity.

Cheers
Serge

Signature

Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.