SCOPE_IDENTITY worked before, not anymore
Posted: Thu 07 Dec 2006 06:30
I need to get IDENTITY of the record I just inserted so that I can use it for other tables. In one of my older programs I used TMSSQL component with this SQL code:
INSERT INTO xxxx
(
Name,
ZIPCode
)
VALUES
(
:Name,
:ZIPCode
)
SET :RowId=SCOPE_IDENTITY()
Parameters are all IN, except RowId which id IN/OUT. At the beginning of the program I do TMSSQL.Prepare.
It worked fine few months ago. I wrote a new program yesterday and it doesn't work anymore. I get this error:
---
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
---
Did something changed in TMSSQL component? I am using the latest build. Database engine is the same (MS SQL Server 2005).
Or, what is the proper way to get IDENTITY now?
Thanks.
Zoran
INSERT INTO xxxx
(
Name,
ZIPCode
)
VALUES
(
:Name,
:ZIPCode
)
SET :RowId=SCOPE_IDENTITY()
Parameters are all IN, except RowId which id IN/OUT. At the beginning of the program I do TMSSQL.Prepare.
It worked fine few months ago. I wrote a new program yesterday and it doesn't work anymore. I get this error:
---
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
---
Did something changed in TMSSQL component? I am using the latest build. Database engine is the same (MS SQL Server 2005).
Or, what is the proper way to get IDENTITY now?
Thanks.
Zoran