Reply to Re: Problem with stored procedure and retrieving inserted identity value

Your name:

Reply:


Posted by Suleon on 07/11/06 14:05

Erland Sommarskog wrote:
> Susanne Klemm (sklemm@gmx.de) writes:
> > create procedure InsertProduct
> > @NEWID int output
> > as
> > begin
> > set nocount on
> > insert into PRODUCT(D_CREATED)values(getdate()+'')
> > set nocount off
> > select @NEWID = @@IDENTITY
> > end
>
> In this case, it's better to use scope_identity(), which returns the most
> recently generated identity value in the current scope. If PRODUCT has a
> trigger which inserts data into a table with another IDENTITY column,
> @@identity will return the value for that latter table.

I tried scope_identity() but got no changes. But indeed there was a
trigger on the product table. After removing it both variants worked.

Thank you!
Susanne

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация