Insert a record and return Auto generated Primary key of the table using Stored procedure?

CREATE PROCEDURE [SampleReturnID]
(   
      @EmployeeName varchar(50),
      @id int output
)
AS
  BEGIN
     
      INSERT INTO  Sample(Name )  VALUES (@EmployeeName )
            SET @id=SCOPE_IDENTITY()
      RETURN  @id
  END

Comments

Popular posts from this blog

Reverse Sentence using c#

How to write Pure java script Program?