>Hello Jerry!
>
>I use code:
>
>Create PROCEDURE [dbo].[insert_mytable]
>@l_1 int, @l_2 varchar(20)
>AS
>Insert into cred.dbo.mytable (field1,field2) VALUES (@l_1,@l2)
>Select @@IDENTITY as 'Identity'
>
>
>Sergey.
NEVER use @@IDENTITY, If you have trigger that affect other table that have IDENTITY field you will get wrong information.
Use SCOPE_IDENTITY() function instead.
Create PROCEDURE [dbo].[insert_mytable]
@l_1 int,
@l_2 varchar(20)
AS
Insert into cred.dbo.mytable (field1,field2) VALUES (@l_1, @l2)
Select SCOPE_IDENTITY() as 'Identity'
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.