| 
 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
 
  
Navigation:
[Reply to this message] 
 |