AUTO INCREMENT BY STORE PROCEDURE

Pawan kumar

Total Post:19

Points:133
Posted by  Pawan kumar
 1893  View(s)
Ratings:
Rate this:

sir  i used this SP but Not autoincement

ALTER PROCEDURE dbo.AutoIncrement(@EmpName varchar(25),@Fathername varchar(25),@Address nvarchar(50),

@Phone nvarchar(12),

@Sex varchar(8),

@MaterialStatus varchar(10))

as

Declare @AEmpId int

select @AEmpId=count(EmpId)from TblEmpReg

IF(@AEmpId='0')

BEGIN

SET @AEmpId='1'

END

SELECT @AEmpId=max(@AEmpId)+1 FROM TblEmpReg

Insert into TblEmpReg(EmpId,EmpName,Fathername,Address,Phone,sex,MaterialStatus)values(@AEmpId,@EmpName,@Fathername,@Address,@Phone,@sex,@MaterialStatus)

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!